On saving a file, whitespace-cleanup does a nice job of cleaning up whitespace:
https://emacsredux.com/blog/2013/05/16/whitespace-cleanup/
However, I would like to be able to leave a blank line at the end of buffer, either globally or add a hook for different modes.
I think if I edit this whitespace-empty-at-eob-regexp
I should be able to do it?
whitespace-empty-at-eob-regexp’s value is "^\\([ ]+\\)\\'"
So I thought I could just add a \n
but this does not achieve what I want:
"^\\([ ]+\\n\)\\'"
The value of
whitespace-empty-at-eob-regexp
is"^\\([ \t\n]+\\)\\'"
actually.I you want to leave a blank line at the end of buffer. Try: