Permalink
Browse files

autosave files on buffer switch

  • Loading branch information...
1 parent 25db0ca commit d362ac021747e80f7bdd137739819905af8cd1cb @langmartin committed Sep 13, 2012
Showing with 7 additions and 0 deletions.
  1. +7 −0 rc-emacs.el
View
@@ -321,4 +321,11 @@ Equivalent to \\[set-mark-command] when \\[transient-mark-mode] is disabled"
(rc-org-mode-line-less-decoration)
(rc-erc-mode-line-less-decoration))
+(progn
+ ;; autosave buffer on window switch
+ (defadvice switch-to-buffer (before save-buffer-now activate)
+ (when buffer-file-name (save-buffer)))
+ (defadvice other-window (before other-window-now activate)
+ (when buffer-file-name (save-buffer))))
+
(provide 'rc-emacs)

0 comments on commit d362ac0

Please sign in to comment.