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

Valery V. Vorotyntsev valery.vv at gmail.com
Fri Nov 16 12:10:04 EST 2007

On 11/16/07, Valery V. Vorotyntsev <valery.vv at gmail.com> wrote:
> Add the following lines to your ~/.emacs:

Adding buffer name to confirmation message:

------- BEGIN -------
(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 (format "Delete trailing whitespace from %s? " (buffer-name))))
------- END -------

> (add-hook 'before-save-hook 'delete-trailing-whitespace-if-confirmed)


More information about the Haskell-Cafe mailing list