aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Stallman2017-02-04 11:16:55 +0200
committerEli Zaretskii2017-02-04 11:16:55 +0200
commit6db5582479bdf6b7b090c5b450534999ef284aa8 (patch)
treef0ed01caee108b6b57cd1fda1bfe6101c29e25c2
parentbe10c00d3d64d53a7f31441d42f6c5b1f75b9916 (diff)
downloademacs-6db5582479bdf6b7b090c5b450534999ef284aa8.tar.gz
emacs-6db5582479bdf6b7b090c5b450534999ef284aa8.zip
New defcustom 'save-some-buffers-default-predicate'
* lisp/files.el (save-some-buffers-default-predicate): New defcustom. (save-some-buffers): Use it when PRED is nil or omitted.
-rw-r--r--etc/NEWS5
-rw-r--r--lisp/files.el12
2 files changed, 17 insertions, 0 deletions
diff --git a/etc/NEWS b/etc/NEWS
index 930e1c893b4..25e1d6e8369 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -758,6 +758,11 @@ instead.
758 758
759* Lisp Changes in Emacs 26.1 759* Lisp Changes in Emacs 26.1
760 760
761** 'save-some-buffers' now uses 'save-some-buffers-default-predicate'
762to decide which buffers to ask about, if the PRED argument is nil.
763The default value of 'save-some-buffers-default-predicate' is nil,
764which means ask about all file-visiting buffers.
765
761** string-(to|as|make)-(uni|multi)byte are now declared obsolete. 766** string-(to|as|make)-(uni|multi)byte are now declared obsolete.
762** New variable 'while-no-input-ignore-events' which allow 767** New variable 'while-no-input-ignore-events' which allow
763setting which special events 'while-no-input' should ignore. 768setting which special events 'while-no-input' should ignore.
diff --git a/lisp/files.el b/lisp/files.el
index 25392fdcc71..2833ec5c124 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -5134,6 +5134,13 @@ Before and after saving the buffer, this function runs
5134 "Non-nil means `save-some-buffers' should save this buffer without asking.") 5134 "Non-nil means `save-some-buffers' should save this buffer without asking.")
5135(make-variable-buffer-local 'buffer-save-without-query) 5135(make-variable-buffer-local 'buffer-save-without-query)
5136 5136
5137(defcustom save-some-buffers-default-predicate nil
5138 "Default predicate for `save-some-buffers'.
5139This allows you to stop `save-some-buffers' from asking
5140about certain files that you'd usually rather not save."
5141 :group 'auto-save
5142 :type 'function)
5143
5137(defun save-some-buffers (&optional arg pred) 5144(defun save-some-buffers (&optional arg pred)
5138 "Save some modified file-visiting buffers. Asks user about each one. 5145 "Save some modified file-visiting buffers. Asks user about each one.
5139You can answer `y' to save, `n' not to save, `C-r' to look at the 5146You can answer `y' to save, `n' not to save, `C-r' to look at the
@@ -5149,10 +5156,13 @@ If PRED is nil, all the file-visiting buffers are considered.
5149If PRED is t, then certain non-file buffers will also be considered. 5156If PRED is t, then certain non-file buffers will also be considered.
5150If PRED is a zero-argument function, it indicates for each buffer whether 5157If PRED is a zero-argument function, it indicates for each buffer whether
5151to consider it or not when called with that buffer current. 5158to consider it or not when called with that buffer current.
5159PRED defaults to the value of `save-some-buffers-default-predicate'.
5152 5160
5153See `save-some-buffers-action-alist' if you want to 5161See `save-some-buffers-action-alist' if you want to
5154change the additional actions you can take on files." 5162change the additional actions you can take on files."
5155 (interactive "P") 5163 (interactive "P")
5164 (unless pred
5165 (setq pred save-some-buffers-default-predicate))
5156 (save-window-excursion 5166 (save-window-excursion
5157 (let* (queried autosaved-buffers 5167 (let* (queried autosaved-buffers
5158 files-done abbrevs-done) 5168 files-done abbrevs-done)
@@ -6812,6 +6822,8 @@ asks whether processes should be killed.
6812Runs the members of `kill-emacs-query-functions' in turn and stops 6822Runs the members of `kill-emacs-query-functions' in turn and stops
6813if any returns nil. If `confirm-kill-emacs' is non-nil, calls it." 6823if any returns nil. If `confirm-kill-emacs' is non-nil, calls it."
6814 (interactive "P") 6824 (interactive "P")
6825 ;; Don't use save-some-buffers-default-predicate, because we want
6826 ;; to ask about all the buffers before killing Emacs.
6815 (save-some-buffers arg t) 6827 (save-some-buffers arg t)
6816 (let ((confirm confirm-kill-emacs)) 6828 (let ((confirm confirm-kill-emacs))
6817 (and 6829 (and