JohnDoe365 · 2022-04-22 05:45
I am aware that I can open a large file literally. This doesn't give me
* EOL auto-detection: I end up opening Windows encoded files with `^M` endings
* File encoding detection: I end up with `\hex` encoded characters
Regularly opening and later switching to fundamental mode has the downside that it might take much longer or actually killing emacs.
So I am looking for the sweet spot: Open the next file literally but do EOL and encoding detection.
How can I do this?
akirakom · 2022-04-22 05:52
Add a function to `find-file-hook`. See https://stackoverflow.com/a/18317181
eli-zaretskii · 2022-04-22 06:48
Use the `so-long` mode. That's what it's for.
JohnDoe365 · 2022-04-22 11:06
Hm, doesn't seem to work:
* When I first enable `global-so-long-mode` and open the file literally, I get no EOL and encoding support.
* When I first enable `global-so-long-mode` and open the file regularly font-lock and file-type specific plugins are all enabled.
So I don't see how this helps me?
EDIT: Nevermind, I figured out that so-long is specifically about files containing long lines. Now a file can be large without long lines.
eli-zaretskii · 2022-04-22 13:29
Invoke `so-long` manually (and configure the defaults if you want).
nnreddit-user · 2022-04-22 13:46
No that's not what it's for. It also shouldn't be promoted as a solution generally.
tompurl · 2022-04-22 15:03
Have you thought about *why* you're opening such a large file in a text editor? Large files should usually be treated as databases instead of articles. Is it possible to use grep/sed/awk instead to programmatically interact with it?