[xmonad] Re: [Haskell-cafe] emacs haskellers: r-stripping files becomes popular

Brent Yorgey byorgey at gmail.com
Fri Nov 16 11:33:18 EST 2007

On Nov 16, 2007 11:14 AM, Valery V. Vorotyntsev <valery.vv at gmail.com> wrote:

> Add the following lines to your ~/.emacs:
> ------- BEGIN OF ELISP CODE -------
> ;(global-set-key (kbd "<f9> s") 'delete-trailing-whitespace)
> (defun delete-trailing-whitespace-if-confirmed ()
>  "Delete all the trailing whitespace across the current buffer,
> asking user for confirmation."
>  (if (and (save-excursion (goto-char (point-min))
>                           (re-search-forward "[[:space:]]$" nil t))
>           (y-or-n-p "Delete trailing whitespace? "))
>      (delete-trailing-whitespace)))
> (add-hook 'before-save-hook 'delete-trailing-whitespace-if-confirmed)
> ------- END OF ELISP CODE -------

Nice!  Is there a way to have this only run if the current buffer is in
haskell-mode?  I'd add it myself but I've not yet taken the plunge to being
an elisp hacker.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/xmonad/attachments/20071116/a21b2fa5/attachment.htm

More information about the xmonad mailing list