about summary refs log tree commit diff
path: root/init
diff options
context:
space:
mode:
Diffstat (limited to 'init')
-rw-r--r--init/functions.el8
1 files changed, 8 insertions, 0 deletions
diff --git a/init/functions.el b/init/functions.el
index 738b6d9f9dc7..726d40f25780 100644
--- a/init/functions.el
+++ b/init/functions.el
@@ -126,4 +126,12 @@ Including indent-buffer, which should not be called automatically on save."
   (let ((derivation (read-string "Derivation name (in <nixos>): ")))
     (insert (nix-store-path derivation))))
 
+(defun toggle-force-newline ()
+  "Buffer-local toggle for enforcing final newline on save."
+  (interactive)
+  (setq-local require-final-newline (not require-final-newline))
+  (message "require-final-newline in buffer %s is now %s"
+           (buffer-name)
+           require-final-newline))
+
 (provide 'functions)