Last active
November 30, 2021 06:29
-
-
Save jordonbiondo/dc4482f07c48cf9ee59a to your computer and use it in GitHub Desktop.
clean up if not makefile
This file contains hidden or 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 all-make-modes | |
| '(makefile-makepp-mode makefile-bsdmake-mode makefile-imake-mode makefile-automake-mode makefile-mode makefile-gmake-mode) | |
| "A list of the makefile major modes") | |
| (defun my-cleanup-buffer-before-save () | |
| (delete-trailing-whitespace (point-min) (point-max)) | |
| (when (and (derived-mode-p 'prog-mode) | |
| (not (member major-mode all-make-modes))) | |
| (indent-region (point-min) (point-max)))) | |
| (add-hook 'before-save-hook 'my-cleanup-buffer-before-save) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment