Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Emacs - require-final-newline local value overrides global value

I want to set the require-final-newline for every buffer to nil. In my config file, I have :

(setq require-final-newline nil)
(setq-default require-final-newline nil)

It appears to set the global value correctly. However in every buffer that I open, the local value is still t. Using describe-variable, I get :

require-final-newline is a variable defined in `files.el'.
Its value is t
Original value was nil
Local in buffer myfile.js; global value is nil

files.el is in /usr/local/Cellar/emacs/24.5/share/emacs/24.5/lisp/, so I guess I should not modify it. How do I set this local value to nil ?

like image 384
nha Avatar asked Mar 14 '23 14:03

nha


1 Answers

Firstly, there are modes which forcibly set require-final-newline on the basis that those kinds of files require a final newline. I don't believe js-mode is one of them, however.

Presumably you have some custom config which is causing this, perhaps set via js-mode-hook or prog-mode-hook.

Confirm with emacs -Q that this is not default behaviour, and then you can set about tracking down the culprit (I would just M-x rgrep for require-final-newline in your elisp files).

like image 126
phils Avatar answered Mar 17 '23 03:03

phils