Delete trailing whitespace, globally, by default
Also adds doom|disable-delete-trailing-whitespace hook, which can be used to disable this behavior on a per-buffer basis. If you want to turn off this global behavior: (remove-hook 'write-file-functions #'delete-trailing-whitespace)
This commit is contained in:
parent
fcf2a26329
commit
edc9bf70af
4 changed files with 18 additions and 10 deletions
|
@ -281,6 +281,14 @@ with weak native support."
|
|||
|
||||
;;;###autoload
|
||||
(defun doom|enable-delete-trailing-whitespace ()
|
||||
"Enables the automatic deletion of trailing whitespaces upon file save, by
|
||||
attaching `delete-trailing-whitespace' to a buffer-local `before-save-hook'."
|
||||
(add-hook 'before-save-hook #'delete-trailing-whitespace nil t))
|
||||
"Enables the automatic deletion of trailing whitespaces upon file save.
|
||||
|
||||
i.e. adds `delete-trailing-whitespace' to `write-file-functions', buffer-locally."
|
||||
(add-hook 'write-file-functions #'delete-trailing-whitespace nil t))
|
||||
|
||||
;;;###autoload
|
||||
(defun doom|disable-delete-trailing-whitespace ()
|
||||
"Disables the automatic deletion of trailing whitespaces upon file save.
|
||||
|
||||
i.e. removes `delete-trailing-whitespace' from `write-file-functions'."
|
||||
(remove-hook 'write-file-functions #'delete-trailing-whitespace t))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue