From 70fe675277e36e0c940c67e0777d871a591943e5 Mon Sep 17 00:00:00 2001 From: 10sr <8.slashes@gmail.com> Date: Wed, 8 May 2019 22:38:38 +0900 Subject: [PATCH] Add my-set-require-final-newline --- emacs.el | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/emacs.el b/emacs.el index 012a6b9..f5c9f87 100644 --- a/emacs.el +++ b/emacs.el @@ -352,6 +352,15 @@ found, otherwise returns nil." ;; Basically it should not set globally (instead use something like file local ;; variables or editorconfig), but for most cases I just need this... (setq-default require-final-newline t) +(defun my-set-require-final-newline () + "Set `require-final-newline'." + (set (make-local-variable 'require-final-newline) + mode-require-final-newline)) + +(add-hook 'prog-mode-hook + 'my-set-require-final-newline) +(add-hook 'conf-mode-hook + 'my-set-require-final-newline) ;; Used from term-cursor ;; hbar is too hard to find...