diff options
Diffstat (limited to 'lisp/files.el')
| -rw-r--r-- | lisp/files.el | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/lisp/files.el b/lisp/files.el index f60282b775a..b7d104853c3 100644 --- a/lisp/files.el +++ b/lisp/files.el | |||
| @@ -3723,7 +3723,8 @@ Return the new variables list." | |||
| 3723 | (let* ((file-name (or (buffer-file-name) | 3723 | (let* ((file-name (or (buffer-file-name) |
| 3724 | ;; Handle non-file buffers, too. | 3724 | ;; Handle non-file buffers, too. |
| 3725 | (expand-file-name default-directory))) | 3725 | (expand-file-name default-directory))) |
| 3726 | (sub-file-name (if file-name | 3726 | (sub-file-name (if (and file-name |
| 3727 | (file-name-absolute-p file-name)) | ||
| 3727 | ;; FIXME: Why not use file-relative-name? | 3728 | ;; FIXME: Why not use file-relative-name? |
| 3728 | (substring file-name (length root))))) | 3729 | (substring file-name (length root))))) |
| 3729 | (condition-case err | 3730 | (condition-case err |
| @@ -5133,6 +5134,14 @@ Before and after saving the buffer, this function runs | |||
| 5133 | "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.") |
| 5134 | (make-variable-buffer-local 'buffer-save-without-query) | 5135 | (make-variable-buffer-local 'buffer-save-without-query) |
| 5135 | 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 | :version "26.1") | ||
| 5144 | |||
| 5136 | (defun save-some-buffers (&optional arg pred) | 5145 | (defun save-some-buffers (&optional arg pred) |
| 5137 | "Save some modified file-visiting buffers. Asks user about each one. | 5146 | "Save some modified file-visiting buffers. Asks user about each one. |
| 5138 | You can answer `y' to save, `n' not to save, `C-r' to look at the | 5147 | You can answer `y' to save, `n' not to save, `C-r' to look at the |
| @@ -5148,10 +5157,13 @@ If PRED is nil, all the file-visiting buffers are considered. | |||
| 5148 | If PRED is t, then certain non-file buffers will also be considered. | 5157 | If PRED is t, then certain non-file buffers will also be considered. |
| 5149 | If PRED is a zero-argument function, it indicates for each buffer whether | 5158 | If PRED is a zero-argument function, it indicates for each buffer whether |
| 5150 | to consider it or not when called with that buffer current. | 5159 | to consider it or not when called with that buffer current. |
| 5160 | PRED defaults to the value of `save-some-buffers-default-predicate'. | ||
| 5151 | 5161 | ||
| 5152 | See `save-some-buffers-action-alist' if you want to | 5162 | See `save-some-buffers-action-alist' if you want to |
| 5153 | change the additional actions you can take on files." | 5163 | change the additional actions you can take on files." |
| 5154 | (interactive "P") | 5164 | (interactive "P") |
| 5165 | (unless pred | ||
| 5166 | (setq pred save-some-buffers-default-predicate)) | ||
| 5155 | (save-window-excursion | 5167 | (save-window-excursion |
| 5156 | (let* (queried autosaved-buffers | 5168 | (let* (queried autosaved-buffers |
| 5157 | files-done abbrevs-done) | 5169 | files-done abbrevs-done) |
| @@ -6571,7 +6583,7 @@ normally equivalent short `-D' option is just passed on to | |||
| 6571 | (unless (equal switches "") | 6583 | (unless (equal switches "") |
| 6572 | ;; Split the switches at any spaces so we can | 6584 | ;; Split the switches at any spaces so we can |
| 6573 | ;; pass separate options as separate args. | 6585 | ;; pass separate options as separate args. |
| 6574 | (split-string switches))) | 6586 | (split-string-and-unquote switches))) |
| 6575 | ;; Avoid lossage if FILE starts with `-'. | 6587 | ;; Avoid lossage if FILE starts with `-'. |
| 6576 | '("--") | 6588 | '("--") |
| 6577 | (progn | 6589 | (progn |
| @@ -6811,6 +6823,8 @@ asks whether processes should be killed. | |||
| 6811 | Runs the members of `kill-emacs-query-functions' in turn and stops | 6823 | Runs the members of `kill-emacs-query-functions' in turn and stops |
| 6812 | if any returns nil. If `confirm-kill-emacs' is non-nil, calls it." | 6824 | if any returns nil. If `confirm-kill-emacs' is non-nil, calls it." |
| 6813 | (interactive "P") | 6825 | (interactive "P") |
| 6826 | ;; Don't use save-some-buffers-default-predicate, because we want | ||
| 6827 | ;; to ask about all the buffers before killing Emacs. | ||
| 6814 | (save-some-buffers arg t) | 6828 | (save-some-buffers arg t) |
| 6815 | (let ((confirm confirm-kill-emacs)) | 6829 | (let ((confirm confirm-kill-emacs)) |
| 6816 | (and | 6830 | (and |