I don't like Emacs' default autosave feature, which is more excessive and less effective than what I want. I hope that Emacs automatically save files into themselves as the name indicates and do it without generating any other files.
Nowadays, we usually use VCS(Version Control Systems) such as CVS, Subversion, SVK etc., so recover-file feature is less useful than it used to be, I think. Emacs just saves them automatically. We just revert the files from repositories, if we need. It's sufficient, isn't it?
Actually, this isn't my original idea. Satoru Takabayashi coined the ides and wrote a tiny elisp named `auto-save-buffers.el' to implement it few years ago. `auto-save-buffers-enhanced' is an enhanced version against the original.
After installing auto-save-buffers-enhanced.el into load-path, just simply put the code below into your .emacs:
(require 'auto-save-buffers-enhanced) (auto-save-buffers-enhanced t)
You can explicitly set what kind of files should or should not be auto-saved. Pass a list of regexps like below:
(setq auto-save-buffers-enhanced-include-regexps '(".+")) (setq auto-save-buffers-enhanced-exclude-regexps '("^not-save-file" "\\.ignore$"))
;; If you're using CVS or Subversion (require 'auto-save-buffers-enhanced) (auto-save-buffers-enhanced-include-only-checkout-path t) (auto-save-buffers-enhanced t) ;; If you're using svk (require 'auto-save-buffers-enhanced) (setq auto-save-buffers-enhanced-use-svk-flag t) (auto-save-buffers-enhanced-include-only-checkout-path t) (auto-save-buffers-enhanced t)
You can toggle `auto-save-buffers-enhanced' activity to execute `auto-save-buffers-enhanced-toggle-activity'. For convinience, you might want to set keyboard shortcut of the command like below:
(global-set-key "\C-x a s" 'auto-save-buffers-enhanced-toggle-activity)