all repos — archive/dotfiles @ 8a2b251810f31e6fe4caf1217d3647a32fceb905

Superseded by nixfiles

Emacs: Use built-in trailing whitespace instead of ws-butler
Alan Pearce alan@alanpearce.uk
Thu, 27 Apr 2017 11:58:39 +0200
commit

8a2b251810f31e6fe4caf1217d3647a32fceb905

parent

bb46cf8f8ff70e89514f30a07b0619df23b6f09d

1 files changed, 11 insertions(+), 11 deletions(-)

jump to
M emacs/.emacs.d/init.orgemacs/.emacs.d/init.org
@@ -669,20 +669,20 @@ (other-window 1))         (kill-buffer buf)))))
 #+END_SRC
 
-** Whitespace Butler
+** Whitespace
 
-I don’t like it when editors change an entire file’s layout when I
-open it.  Whitespace butler fixes whitespace only for lines that I’m editing.
+Show bad whitespace, so that I can fix it.
 
 #+BEGIN_SRC emacs-lisp
-(use-package ws-butler
-  :if window-system
-  :diminish ws-butler-mode
-  :config (ws-butler-global-mode 1))
-(if (daemonp)
-    (add-hook 'before-make-frame-hook (lambda ()
-                                        (use-package ws-butler
-                                          :config (ws-butler-global-mode 1)))))
+(defun show-trailing-whitespace-on ()
+  (interactive)
+  (setq-local show-trailing-whitespace t))
+(defun show-trailing-whitespace-off ()
+  (interactive)
+  (setq-local show-trailing-whitespace nil))
+(add-hook 'prog-mode-hook #'show-trailing-whitespace-on)
+(add-hook 'text-mode-hook #'show-trailing-whitespace-on)
+(setq-default show-trailing-whitespace t)
 #+END_SRC
 
 ** shrink-whitespace