From 473ff3b04bd3d4b67e1db1a418089edbd8cd976b Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Wed, 24 Jan 2007 17:08:11 +0000 Subject: [PATCH] dot-emacs: Highlight trailing whitespace, so that we can kill it. --- dot-emacs.el | 44 ++++++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/dot-emacs.el b/dot-emacs.el index 6500bbb..7b7d4d5 100644 --- a/dot-emacs.el +++ b/dot-emacs.el @@ -499,6 +499,7 @@ doesn't cope with anything approximating a complicated case." (setq comment-column 40) (auto-fill-mode 1) (setq fill-column 77) + (setq show-trailing-whitespace t) (mdw-set-font)) ;; --- Set up all sorts of faces --- @@ -512,26 +513,28 @@ doesn't cope with anything approximating a complicated case." ;;;----- General fontification ---------------------------------------------- -(defun mdw-set-fonts (frame ff) - (if ff (progn (set-face-attribute (caar ff) frame - :family 'unspecified - :width 'unspecified - :height 'unspecified - :weight 'unspecified - :slant 'unspecified - :foreground 'unspecified - :background 'unspecified - :underline 'unspecified - :overline 'unspecified - :strike-through 'unspecified - :box 'unspecified - :inverse-video 'unspecified - :stipple 'unspecified -; :font 'unspecified - :inherit 'unspecified - ) - (apply 'set-face-attribute (caar ff) frame (cdar ff)) - (mdw-set-fonts frame (cdr ff))))) +(defun mdw-set-fonts (frame faces) + (while faces + (let ((face (caar faces))) + (or (facep face) (make-face face)) + (set-face-attribute face frame + :family 'unspecified + :width 'unspecified + :height 'unspecified + :weight 'unspecified + :slant 'unspecified + :foreground 'unspecified + :background 'unspecified + :underline 'unspecified + :overline 'unspecified + :strike-through 'unspecified + :box 'unspecified + :inverse-video 'unspecified + :stipple 'unspecified + ;:font 'unspecified + :inherit 'unspecified) + (apply 'set-face-attribute face frame (cdar faces)) + (setq faces (cdr faces))))) (defun mdw-do-set-font (&optional frame) (interactive) @@ -578,6 +581,7 @@ doesn't cope with anything approximating a complicated case." (diff-removed-face :foreground "white" :slant italic) (whizzy-slice-face :background "grey10") (whizzy-error-face :background "darkred") + (trailing-whitespace :background "red") ))) (defun mdw-set-font () -- 2.11.0