By default, Emacs quietly deletes trailing whitespaces once the user moves on to the next line. To reproduce the issue in plain Emacs, do this:
- Start plain Emacs:
emacs --no-init-file --no-site-file
- Insert trailing tabs or spaces on the first line (e.g. five spaces).
- Press enter to go to the second line.
- Now go back to the first line. The spaces we inserted in step 2 have all disappeared!
This is not good. I want to preserve the trailing whitespace I have typed. Default Emacs seems to make it impossible for me to enter trailing whitespace.
Questions:
- What is the cause or rationale for this default behavior?
- How can I preserve the trailing whitespace I have entered?
test.txt
. Emacs uses text mode. I'm using Emacs 25.2.2. Older versions could have different behavior. What's your Emacs version?