Tue
26 Oct 2004
2:41 pm
Emacs require-final-newline on fedora: How to kill it!
Posted by shimon under computers/Unix/emacs , kind of writing/tips[14] Comments
I have been annoyed that emacs21 on a fedora core 2 machine keeps asking me:
(This file) does not end in newline. Add one?
Of course I don't want to add one. If I wanted to add a new line I'd just hit Alt-Shift-. Enter like every sane person. Right? Shut up, emacs.
OK, simple enough. Just set require-final-newline to nil. Just put that setting into my .emacs file.
This didn't work: (setq require-final-newline nil)
This also didn't work: (setq-default require-final-newline nil)
Using emacs' own customization system, it still didn't work. I could set the variable in a session, but after quitting and starting again the setting didn't stick.
I started to worry. Then I tracked it down.
The non-nil setting comes from /usr/share/emacs/site-lisp/default.el. This apparently runs after your .emacs and, on FC2, sets require-final-newline to 'query. So to stop this atrocity, you have two options:
-
Become root, and edit /usr/share/emacs/site-lisp/default.el.
-
Avoid running this silly default.el file by putting into your .emacs:
(setq inhibit-default-init t)
I chose the latter option. Perhaps this post will help future Google searchers do the right thing even faster.
Full Entries RSS