Good Haskell Style
bojohan+news at dd.chalmers.se
Fri Aug 17 07:47:52 EDT 2007
Simon Marlow <simonmarhaskell at gmail.com> writes:
> While we're on emacs... I know I can colour trailing whitespace
> differently, but that's just annoying.
You could use something more discreet, like colored underlines.
> What I want is: on lines that I edit, remove the trailing whitespace
> (and if I undo the edit, put the whitespace back too). Is there
> something that does that?
;; Difficulties are that a) in general changes doesn't necessarily
;; happen at the location of point, and OTOH b) commands can
;; temporarily move point behind the scenes, but c) we don't want
;; characters do disappear under our feet (point) . Try to do
;; something sensible.
(defun line-delete-trailing-whitespace (beg end len)
(unless (or (eolp) undo-in-progress)
(delete-char (- (skip-chars-backward " \t" end))))))
;; Buffer local, use a mode hook
(add-hook 'after-change-functions 'line-delete-trailing-whitespace nil t)
;; To see what's going on
(setq show-trailing-whitespace t)
More information about the Libraries