summaryrefslogtreecommitdiff
path: root/lisp/files.el
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2017-09-29 10:02:33 +0300
committerEli Zaretskii <eliz@gnu.org>2017-09-29 10:02:33 +0300
commitc1ac8c170f17a98b7e5d6e098f707daeb71ea27d (patch)
treedffdc5f4a509ec200b69c09f52b979f42d31e10b /lisp/files.el
parent18073beb14f393b4bbcc92890a89dcfcb75fb7ac (diff)
parentaf130f900fc499f71ea22f10ba055a75ce35ed4e (diff)
downloademacs-c1ac8c170f17a98b7e5d6e098f707daeb71ea27d.tar.gz
emacs-c1ac8c170f17a98b7e5d6e098f707daeb71ea27d.tar.bz2
emacs-c1ac8c170f17a98b7e5d6e098f707daeb71ea27d.zip
Merge branch 'emacs-26' of git.savannah.gnu.org:/srv/git/emacs into emacs-26
Diffstat (limited to 'lisp/files.el')
-rw-r--r--lisp/files.el19
1 files changed, 10 insertions, 9 deletions
diff --git a/lisp/files.el b/lisp/files.el
index f0a1f2380d9..211457ac7d7 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -150,8 +150,13 @@ Called with an absolute file name as argument, it returns t to enable backup.")
(defcustom buffer-offer-save nil
"Non-nil in a buffer means always offer to save buffer on exit.
Do so even if the buffer is not visiting a file.
-Automatically local in all buffers."
- :type 'boolean
+Automatically local in all buffers.
+
+Set to the symbol `always' to offer to save buffer whenever
+`save-some-buffers' is called."
+ :type '(choice (const :tag "Never" nil)
+ (const :tag "On Emacs exit" t)
+ (const :tag "Whenever save-some-buffers is called" always))
:group 'backup)
(make-variable-buffer-local 'buffer-offer-save)
(put 'buffer-offer-save 'permanent-local t)
@@ -5188,15 +5193,11 @@ change the additional actions you can take on files."
(and (buffer-live-p buffer)
(buffer-modified-p buffer)
(not (buffer-base-buffer buffer))
- (not (eq (aref (buffer-name buffer) 0) ?\s))
(or
(buffer-file-name buffer)
- (and pred
- (progn
- (set-buffer buffer)
- (and buffer-offer-save (> (buffer-size) 0))))
- (buffer-local-value
- 'write-contents-functions buffer))
+ (with-current-buffer buffer
+ (or (eq buffer-offer-save 'always)
+ (and pred buffer-offer-save (> (buffer-size) 0)))))
(or (not (functionp pred))
(with-current-buffer buffer (funcall pred)))
(if arg