Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
clean up if not makefile
(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
You can’t perform that action at this time.