mirror of
https://github.com/doomemacs/doomemacs
synced 2025-09-16 15:56:52 -05:00
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:
@@ -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))
|
||||
|
Reference in New Issue
Block a user