aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Abrahamsen2017-09-24 14:01:21 -0700
committerEric Abrahamsen2017-09-24 14:57:40 -0700
commit3d3778d82a87139ef50a24146f5bad2a57a82094 (patch)
tree3de6a894ff4142d733646a5e0b8fcfed887ed088
parent638f64c40a678c26d78a7d7279e6356e6e92f3fd (diff)
downloademacs-3d3778d82a87139ef50a24146f5bad2a57a82094.tar.gz
emacs-3d3778d82a87139ef50a24146f5bad2a57a82094.zip
Accept new `always' value for option `buffer-offer-save'
Also revert ee512e9a82 * lisp/files.el (buffer-offer-save): In addition to nil and t, now allows a third symbol value, `always'. A buffer where this option is set to `always' will always be offered for save by `save-some-buffers'. (save-some-buffers): Check the exact value of this buffer-local variable. No longer check the buffer name, or the value of `write-contents-functions'. * doc/lispref/buffers.texi (Killing Buffers): Note change in manual. * doc/lispref/files.texi (Saving Buffers): Remove note about buffer names. * etc/NEWS: Mention in NEWS.
-rw-r--r--doc/lispref/buffers.texi15
-rw-r--r--doc/lispref/files.texi3
-rw-r--r--etc/NEWS8
-rw-r--r--lisp/files.el19
4 files changed, 26 insertions, 19 deletions
diff --git a/doc/lispref/buffers.texi b/doc/lispref/buffers.texi
index cf24a730ba6..0d02cb3d3e9 100644
--- a/doc/lispref/buffers.texi
+++ b/doc/lispref/buffers.texi
@@ -1089,12 +1089,15 @@ is not cleared by changing major modes.
1089 1089
1090@defopt buffer-offer-save 1090@defopt buffer-offer-save
1091This variable, if non-@code{nil} in a particular buffer, tells 1091This variable, if non-@code{nil} in a particular buffer, tells
1092@code{save-buffers-kill-emacs} and @code{save-some-buffers} (if the 1092@code{save-buffers-kill-emacs} to offer to save that buffer, just as
1093second optional argument to that function is @code{t}) to offer to 1093it offers to save file-visiting buffers. If @code{save-some-buffers}
1094save that buffer, just as they offer to save file-visiting buffers. 1094is called with the second optional argument set to @code{t}, it will
1095@xref{Definition of save-some-buffers}. The variable 1095also offer to save the buffer. Lastly, if this variable is set to the
1096@code{buffer-offer-save} automatically becomes buffer-local when set 1096symbol @code{always}, both @code{save-buffers-kill-emacs} and
1097for any reason. @xref{Buffer-Local Variables}. 1097@code{save-some-buffers} will always offer to save. @xref{Definition
1098of save-some-buffers}. The variable @code{buffer-offer-save}
1099automatically becomes buffer-local when set for any reason.
1100@xref{Buffer-Local Variables}.
1098@end defopt 1101@end defopt
1099 1102
1100@defvar buffer-save-without-query 1103@defvar buffer-save-without-query
diff --git a/doc/lispref/files.texi b/doc/lispref/files.texi
index b1b858a6b4b..f49b02de97c 100644
--- a/doc/lispref/files.texi
+++ b/doc/lispref/files.texi
@@ -368,8 +368,7 @@ With an argument of 0, unconditionally do @emph{not} make any backup file.
368This command saves some modified file-visiting buffers. Normally it 368This command saves some modified file-visiting buffers. Normally it
369asks the user about each buffer. But if @var{save-silently-p} is 369asks the user about each buffer. But if @var{save-silently-p} is
370non-@code{nil}, it saves all the file-visiting buffers without 370non-@code{nil}, it saves all the file-visiting buffers without
371querying the user. Additionally, buffers whose name begins with a 371querying the user.
372space (``internal'' buffers) will not be offered for save.
373 372
374@vindex save-some-buffers-default-predicate 373@vindex save-some-buffers-default-predicate
375The optional @var{pred} argument provides a predicate that controls 374The optional @var{pred} argument provides a predicate that controls
diff --git a/etc/NEWS b/etc/NEWS
index 19a68933c0b..040d265f75b 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -117,6 +117,11 @@ The effect is similar to that of "toolBar" resource on the tool bar.
117 117
118* Changes in Emacs 26.1 118* Changes in Emacs 26.1
119 119
120+++
121** Option 'buffer-offer-save' can be set to new value, 'always'. When
122 set to 'always', the command `save-some-buffers' will always offer
123 this buffer for saving.
124
120** Security vulnerability related to Enriched Text mode is removed. 125** Security vulnerability related to Enriched Text mode is removed.
121 126
122+++ 127+++
@@ -144,8 +149,7 @@ init file:
144'save-buffer' process. Previously, saving a buffer that was not 149'save-buffer' process. Previously, saving a buffer that was not
145visiting a file would always prompt for a file name. Now it only does 150visiting a file would always prompt for a file name. Now it only does
146so if 'write-contents-functions' is nil (or all its functions return 151so if 'write-contents-functions' is nil (or all its functions return
147nil). A non-nil buffer-local value for this variable is sufficient 152nil).
148for 'save-some-buffers' to consider the buffer for saving.
149 153
150--- 154---
151** New variable 'executable-prefix-env' for inserting magic signatures. 155** New variable 'executable-prefix-env' for inserting magic signatures.
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.")
150(defcustom buffer-offer-save nil 150(defcustom buffer-offer-save nil
151 "Non-nil in a buffer means always offer to save buffer on exit. 151 "Non-nil in a buffer means always offer to save buffer on exit.
152Do so even if the buffer is not visiting a file. 152Do so even if the buffer is not visiting a file.
153Automatically local in all buffers." 153Automatically local in all buffers.
154 :type 'boolean 154
155Set to the symbol `always' to offer to save buffer whenever
156`save-some-buffers' is called."
157 :type '(choice (const :tag "Never" nil)
158 (const :tag "On Emacs exit" t)
159 (const :tag "Whenever save-some-buffers is called" always))
155 :group 'backup) 160 :group 'backup)
156(make-variable-buffer-local 'buffer-offer-save) 161(make-variable-buffer-local 'buffer-offer-save)
157(put 'buffer-offer-save 'permanent-local t) 162(put 'buffer-offer-save 'permanent-local t)
@@ -5188,15 +5193,11 @@ change the additional actions you can take on files."
5188 (and (buffer-live-p buffer) 5193 (and (buffer-live-p buffer)
5189 (buffer-modified-p buffer) 5194 (buffer-modified-p buffer)
5190 (not (buffer-base-buffer buffer)) 5195 (not (buffer-base-buffer buffer))
5191 (not (eq (aref (buffer-name buffer) 0) ?\s))
5192 (or 5196 (or
5193 (buffer-file-name buffer) 5197 (buffer-file-name buffer)
5194 (and pred 5198 (with-current-buffer buffer
5195 (progn 5199 (or (eq buffer-offer-save 'always)
5196 (set-buffer buffer) 5200 (and pred buffer-offer-save (> (buffer-size) 0)))))
5197 (and buffer-offer-save (> (buffer-size) 0))))
5198 (buffer-local-value
5199 'write-contents-functions buffer))
5200 (or (not (functionp pred)) 5201 (or (not (functionp pred))
5201 (with-current-buffer buffer (funcall pred))) 5202 (with-current-buffer buffer (funcall pred)))
5202 (if arg 5203 (if arg