Created
October 20, 2012 18:42
-
-
Save nfunato/3924312 to your computer and use it in GitHub Desktop.
whitespace busters for Emacs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defvar undesirable-ws-cleanup-wo-choice-modes | |
'(lisp-mode)) | |
(defvar undesirable-ws-cleanup-w-check-modes | |
'(org-mode)) | |
(defun undesirable-ws-cleanup () | |
(interactive) | |
(save-excursion | |
(when (or (member major-mode undesirable-ws-cleanup-wo-choice-modes) | |
(and (member major-mode undesirable-ws-cleanup-w-check-modes) | |
(y-or-n-p "Really untabify/delete-trailing-whitespace ? "))) | |
(untabify (point-min) (point-max)) | |
(delete-trailing-whitespace (point-min) (point-max)))) | |
nil) | |
(add-hook 'before-save-hook 'undesirable-ws-cleanup) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment