diff options
author | Vincent Ambo <tazjin@gmail.com> | 2017-11-22T22·55+0100 |
---|---|---|
committer | Vincent Ambo <tazjin@gmail.com> | 2017-11-22T22·55+0100 |
commit | f93f03661beb8cbb88e24609d06c1f4c9fea8b6e (patch) | |
tree | 91ae4147df024a180fc203d9f6be11ce5a58e929 | |
parent | 4dce87d1e21e06f3321b974ebc3f37490121ebfc (diff) |
feat(functions): Add function to toggle final-newline behaviour
-rw-r--r-- | init/functions.el | 8 |
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) |