
Additionally, I find this to be helpful for keeping out trailing whitespace: ;; Highlight trailing whitespace in haskell files (add-hook 'haskell-mode-hook '(lambda () (setq show-trailing-whitespace t))) Cheers, -Greg Heartsfield On Fri, Nov 16, 2007 at 06:14:57PM +0200, Valery V. Vorotyntsev 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