When loading a file in emacs (via find-file), emacs loads the file into a buffer with the appropriate mode, invoking the appropriate handlers, etc. Sometimes, for debugging, I would like to be able to load a file directly into fundamental mode, without triggering anything else. What is the simplest way of doing this?
Emacs modes are established for each file you open, so opening Emacs in "nothing mode" doesn't necessarily accomplish what you're after. Each file you open after starting Emacs will get its own mode applied.
When you use M-x find-file-literally Emacs will not invoke a mode that is based on the file name. Instead, it uses fundamental-mode as the major mode.
Using ‘require’ adds a dependency: Not only must a file with the same name (plus “.el” or “.elc” extension) exist, but in that file, Emacs wants to see a statement such as this:
You can use the command @clemera provides to open a file in fundamental mode from the command line. You can do the same from an already-running Emacs via M-x find-file-literally. You can "turn-off" the major mode for a file you've already opened by selecting fundamental mode (which is basically "nothing mode"): M-x fundamental-mode.
Use find-file-literally
. Answer is 30 chars min.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With