🔗 emacs/whitespace.el: visualize blanks (TAB, (HARD) SPACE and NEWLINE).
show-trailing-whitespace
は、便利だけれどtext-mode
などでは多少うざいときもあるので prog-mode-hook
で使っている。
というTipsもありますが、自分は手動で削除できるようにしている。
(leaf whitespace
:ensure t
:bind ("C-c C-c" . my:cleanup-for-spaces)
:hook (prog-mode-hook . my:enable-trailing-mode)
:custom (show-trailing-whitespace . nil)
:config
(defun my:enable-trailing-mode ()
"Show tail whitespace."
(setq show-trailing-whitespace t))
(defun my:cleanup-for-spaces ()
"Remove contiguous line breaks at end of line + end of file."
(interactive)
(delete-trailing-whitespace)
(save-excursion
(save-restriction
(widen)
(goto-char (point-max))
(delete-blank-lines)))))