How do I completely disable all auto-indentation in Emacs? I need to disable it at least for Fundamental mode, but I'm fine with it being disabled globally for the current session.
Please read the rest of this question before declaring it a duplicate. All the other answers I've found are for much more targeted disabling of indentation. I really want to completely disable all auto-indentation for the whole session.
Setting electric-layout-mode
to nil
does not work.
Details
Sometimes I like to compose large Git commit messages with my Windows ASCII text editor. These messages frequently have bullet lists, code blocks, or other things where the precise formatting in my source document is meaningful. My codebase is on Linux, and I connect to the box using a text-only SSH client. When Git enters Emacs for editing the commit message, I want to be able to copy the source commit message to the Windows clipboard then paste it using Windows paste commands. From the perspective of Emacs, I'm typing what was found in the Windows text file. Unfortunately, when Emacs sees indented lines, it adds its own auto-indentation, so I get this huge triangle of whitespace along the left edge of the buffer.
I'm using GNU Emacs 24.3.1.
Workaround
My current workaround is to transfer my Windows text file to a filesystem that's mounted by my Linux host, load the file into Emacs, then use kill and yank to transfer the content. This is a bit clunky.
Example
Here's an example block of text:
a
- b
c
d
Here is how it appears when I paste that into Emacs-under-ssh via MSWin paste:
a
- b
c
d
If I press C-h l
after doing the paste, here is what I see. Note that the newlines are input using C-j
, not RET
.
a C-j C-j SPC SPC - SPC b C-j SPC SPC SPC SPC c C-j
SPC SPC SPC SPC d C-j C-h l