I've enabled require-final-newline
, because I usually want Emacs to add newlines to my files where it's missing. But there are some cases, where I want Emacs to remove the newline (like when editing a yasnippet that should not produce a newline, see emacs + latex + yasnippet: Why are newlines inserted after a snippet?).
Is there a way to achieve this temporarly (like enabling a mode or something), without having to change .emacs
and restarting Emacs?
In addition to what @eldrich mentioned, you can set its value locally in a given buffer. Put something like this on a mode hook, to turn it off for a given mode:
(defun foo () (set (make-local-variable 'require-final-newline) nil))
(add-hook 'some-mode-hook 'foo)