From 5f81a0bdd8f4b544b5e91248091bf09e927fca47 Mon Sep 17 00:00:00 2001
From: Bozhidar Batsov <bozhidar@empowerunited.com>
Date: Wed, 7 Mar 2012 11:51:57 +0200
Subject: [PATCH] moved the auto-save code to the editor module

---
 modules/prelude-core.el   | 15 ---------------
 modules/prelude-editor.el | 15 +++++++++++++++
 2 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/modules/prelude-core.el b/modules/prelude-core.el
index ff77424..c766496 100644
--- a/modules/prelude-core.el
+++ b/modules/prelude-core.el
@@ -360,20 +360,5 @@ there's a region, all lines that region covers will be duplicated."
   (global-set-key [M-left]  'left-word)
   (message "Arrow keys navigation in buffers in now allowed."))
 
-;; automatically save buffers associated with files on buffer switch
-;; and on windows 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)))
-(defadvice windmove-up (before other-window-now activate)
-  (when buffer-file-name (save-buffer)))
-(defadvice windmove-down (before other-window-now activate)
-  (when buffer-file-name (save-buffer)))
-(defadvice windmove-left (before other-window-now activate)
-  (when buffer-file-name (save-buffer)))
-(defadvice windmove-right (before other-window-now activate)
-  (when buffer-file-name (save-buffer)))
-
 (provide 'prelude-core)
 ;;; prelude-core.el ends here
diff --git a/modules/prelude-editor.el b/modules/prelude-editor.el
index 3eb23be..0b1ef3a 100644
--- a/modules/prelude-editor.el
+++ b/modules/prelude-editor.el
@@ -126,6 +126,21 @@
 (require 'windmove)
 (windmove-default-keybindings 'super)
 
+;; automatically save buffers associated with files on buffer switch
+;; and on windows 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)))
+(defadvice windmove-up (before other-window-now activate)
+  (when buffer-file-name (save-buffer)))
+(defadvice windmove-down (before other-window-now activate)
+  (when buffer-file-name (save-buffer)))
+(defadvice windmove-left (before other-window-now activate)
+  (when buffer-file-name (save-buffer)))
+(defadvice windmove-right (before other-window-now activate)
+  (when buffer-file-name (save-buffer)))
+
 ;; show-paren-mode: subtle highlighting of matching parens
 (show-paren-mode t)
 (setq show-paren-style 'parenthesis)