moved the auto-save code to the editor module

This commit is contained in:
Bozhidar Batsov 2012-03-07 11:51:57 +02:00
parent d0e5ef316d
commit 5f81a0bdd8
2 changed files with 15 additions and 15 deletions

View file

@ -360,20 +360,5 @@ there's a region, all lines that region covers will be duplicated."
(global-set-key [M-left] 'left-word) (global-set-key [M-left] 'left-word)
(message "Arrow keys navigation in buffers in now allowed.")) (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) (provide 'prelude-core)
;;; prelude-core.el ends here ;;; prelude-core.el ends here

View file

@ -126,6 +126,21 @@
(require 'windmove) (require 'windmove)
(windmove-default-keybindings 'super) (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: subtle highlighting of matching parens
(show-paren-mode t) (show-paren-mode t)
(setq show-paren-style 'parenthesis) (setq show-paren-style 'parenthesis)