Replace delete-trailing-whitespace with ws-butler
ws-butler only strips trailing spaces on lines that have been modified. + ws-butler is disabled if editorconfig enables trim_trailing_whitespace, which resorts to delete-trailing-whitespace instead. + Updates doom|(enable|disable)-delete-trailing-whitespace hooks to use ws-butler-mode.
This commit is contained in:
parent
a33165d47a
commit
d80e79203a
4 changed files with 20 additions and 9 deletions
|
@ -283,12 +283,12 @@ with weak native support."
|
|||
(defun doom|enable-delete-trailing-whitespace ()
|
||||
"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))
|
||||
i.e. enables `ws-butler-mode' in the current buffer."
|
||||
(ws-butler-mode +1))
|
||||
|
||||
;;;###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))
|
||||
i.e. disables `ws-butler-mode' in the current buffer."
|
||||
(ws-butler-mode -1))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue