[Haskell-cafe] emacs haskellers: r-stripping files becomes popular
Conal Elliott
conal at conal.net
Sat Nov 24 22:55:22 EST 2007
why care about trailing whitespace?
On Nov 16, 2007 8: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 -------
>
> Have fun!
>
> --
> vvv
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20071124/8124a0a6/attachment.htm
More information about the Haskell-Cafe
mailing list