Created
February 24, 2012 02:14
-
-
Save aaronc/1896712 to your computer and use it in GitHub Desktop.
A simple minor mode that can be added to emacs to automatically save a file while you are typing.
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
(define-minor-mode auto-save-mode | |
"Auto-save mode" | |
nil " Reload" nil | |
(if auto-save-mode | |
;; Edit hook buffer-locally. | |
(add-hook 'post-command-hook 'auto-save nil t) | |
(remove-hook 'post-command-hook 'auto-save t))) | |
(defun auto-save () | |
(when (buffer-modified-p) | |
(save-buffer))) | |
(provide 'auto-save) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment