diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2010-05-07 08:49:14 -0400 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2010-05-07 08:49:14 -0400 |
commit | f3ee9200b8199ed00514ffa27079ba780bc2746f (patch) | |
tree | baaeee38bbabfc5f2fb77ba0a2ca2259bcd05605 /lisp/simple.el | |
parent | 5f43e51c03f72ce8be50c475b5e0fc3cd6f94a83 (diff) | |
download | emacs-f3ee9200b8199ed00514ffa27079ba780bc2746f.tar.gz |
* files.el (auto-save-mode): Move to simple.el to fix bootstrap.
* simple.el (auto-save-mode): Move from files.el.
* minibuffer.el (completion--common-suffix): Fix copy&paste error.
Diffstat (limited to 'lisp/simple.el')
-rw-r--r-- | lisp/simple.el | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lisp/simple.el b/lisp/simple.el index 8e45ca4694d..5948536262c 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -5306,6 +5306,26 @@ With ARG, turn Size Indication mode on if ARG is positive, otherwise turn it off. When Size Indication mode is enabled, the size of the accessible part of the buffer appears in the mode line." :global t :group 'mode-line) + +(define-minor-mode auto-save-mode + "Toggle auto-saving of contents of current buffer. +With prefix argument ARG, turn auto-saving on if positive, else off." + :variable ((and buffer-auto-save-file-name + ;; If auto-save is off because buffer has shrunk, + ;; then toggling should turn it on. + (>= buffer-saved-size 0)) + . (lambda (val) + (setq buffer-auto-save-file-name + (cond + ((null val) nil) + ((and buffer-file-name auto-save-visited-file-name + (not buffer-read-only)) + buffer-file-name) + (t (make-auto-save-file-name)))))) + ;; If -1 was stored here, to temporarily turn off saving, + ;; turn it back on. + (and (< buffer-saved-size 0) + (setq buffer-saved-size 0))) (defgroup paren-blinking nil "Blinking matching of parens and expressions." |