Everything that is installed in the .emacs file can be changed on the fly. For variables, such as require-final-newline , this is simply a matter of changing the variable. For example, you can enter the following code and then use Cx e to evaluate it.
(setq require-final-newline (not require-final-newline))
Then it can be connected as a keyboard shortcut if you want it.
(defun toggle-final-newline (interactive) (setq require-final-newline (not require-final-newline))) (global-set-key (kbd "Cc f") 'toggle-final-newline)
source share