comparison lisp/files.el @ 108296:d46fdf06e110

* 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.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Fri, 07 May 2010 08:49:14 -0400
parents 2fb37c89f2f7
children de84b07503b4
comparison
equal deleted inserted replaced
108295:47521399f06e 108296:d46fdf06e110
5148 (or internal-too (/= (aref name 0) ?\s)) 5148 (or internal-too (/= (aref name 0) ?\s))
5149 (string-match regexp name)) 5149 (string-match regexp name))
5150 (kill-buffer-ask buffer))))) 5150 (kill-buffer-ask buffer)))))
5151 5151
5152 5152
5153 (define-minor-mode auto-save-mode
5154 "Toggle auto-saving of contents of current buffer.
5155 With prefix argument ARG, turn auto-saving on if positive, else off."
5156 :variable ((and buffer-auto-save-file-name
5157 ;; If auto-save is off because buffer has shrunk,
5158 ;; then toggling should turn it on.
5159 (>= buffer-saved-size 0))
5160 . (lambda (val)
5161 (setq buffer-auto-save-file-name
5162 (cond
5163 ((null val) nil)
5164 ((and buffer-file-name auto-save-visited-file-name
5165 (not buffer-read-only))
5166 buffer-file-name)
5167 (t (make-auto-save-file-name))))))
5168 ;; If -1 was stored here, to temporarily turn off saving,
5169 ;; turn it back on.
5170 (and (< buffer-saved-size 0)
5171 (setq buffer-saved-size 0)))
5172
5173 (defun rename-auto-save-file () 5153 (defun rename-auto-save-file ()
5174 "Adjust current buffer's auto save file name for current conditions. 5154 "Adjust current buffer's auto save file name for current conditions.
5175 Also rename any existing auto save file, if it was made in this session." 5155 Also rename any existing auto save file, if it was made in this session."
5176 (let ((osave buffer-auto-save-file-name)) 5156 (let ((osave buffer-auto-save-file-name))
5177 (setq buffer-auto-save-file-name 5157 (setq buffer-auto-save-file-name