
16 Nov
2007
16 Nov
'07
12:10 p.m.
On 11/16/07, Valery V. Vorotyntsev
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)))) (delete-trailing-whitespace))) ------- END -------
(add-hook 'before-save-hook 'delete-trailing-whitespace-if-confirmed)
-- vvv