diff options
| author | Richard Stallman | 2017-02-04 11:16:55 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2017-02-04 11:16:55 +0200 |
| commit | 6db5582479bdf6b7b090c5b450534999ef284aa8 (patch) | |
| tree | f0ed01caee108b6b57cd1fda1bfe6101c29e25c2 | |
| parent | be10c00d3d64d53a7f31441d42f6c5b1f75b9916 (diff) | |
| download | emacs-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/NEWS | 5 | ||||
| -rw-r--r-- | lisp/files.el | 12 |
2 files changed, 17 insertions, 0 deletions
| @@ -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' | ||
| 762 | to decide which buffers to ask about, if the PRED argument is nil. | ||
| 763 | The default value of 'save-some-buffers-default-predicate' is nil, | ||
| 764 | which 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 |
| 763 | setting which special events 'while-no-input' should ignore. | 768 | setting 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'. | ||
| 5139 | This allows you to stop `save-some-buffers' from asking | ||
| 5140 | about 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. |
| 5139 | You can answer `y' to save, `n' not to save, `C-r' to look at the | 5146 | You 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. | |||
| 5149 | If PRED is t, then certain non-file buffers will also be considered. | 5156 | If PRED is t, then certain non-file buffers will also be considered. |
| 5150 | If PRED is a zero-argument function, it indicates for each buffer whether | 5157 | If PRED is a zero-argument function, it indicates for each buffer whether |
| 5151 | to consider it or not when called with that buffer current. | 5158 | to consider it or not when called with that buffer current. |
| 5159 | PRED defaults to the value of `save-some-buffers-default-predicate'. | ||
| 5152 | 5160 | ||
| 5153 | See `save-some-buffers-action-alist' if you want to | 5161 | See `save-some-buffers-action-alist' if you want to |
| 5154 | change the additional actions you can take on files." | 5162 | change 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. | |||
| 6812 | Runs the members of `kill-emacs-query-functions' in turn and stops | 6822 | Runs the members of `kill-emacs-query-functions' in turn and stops |
| 6813 | if any returns nil. If `confirm-kill-emacs' is non-nil, calls it." | 6823 | if 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 |