diff options
| author | Sean Whitton | 2024-10-03 18:36:45 +0800 |
|---|---|---|
| committer | Sean Whitton | 2024-10-03 18:37:01 +0800 |
| commit | cc2ad5c2d1508236e79658936e7c7f532ddba586 (patch) | |
| tree | 51f4f1c39457335e547246d177e0750de9e9a4f6 | |
| parent | 1aeec0db7d206e7664ba68fc5b6720f0535c2978 (diff) | |
| download | emacs-cc2ad5c2d1508236e79658936e7c7f532ddba586.tar.gz emacs-cc2ad5c2d1508236e79658936e7c7f532ddba586.zip | |
New M-~ entry in save-some-buffers-action-alist
* lisp/files.el (save-some-buffers-action-alist): New M-~ entry.
(save-some-buffers):
* doc/emacs/files.texi (Save Commands):
* etc/NEWS: Document the new M-~ binding during C-x s.
| -rw-r--r-- | doc/emacs/files.texi | 3 | ||||
| -rw-r--r-- | etc/NEWS | 5 | ||||
| -rw-r--r-- | lisp/files.el | 11 |
3 files changed, 17 insertions, 2 deletions
diff --git a/doc/emacs/files.texi b/doc/emacs/files.texi index 0866e81233d..a7fef99c593 100644 --- a/doc/emacs/files.texi +++ b/doc/emacs/files.texi | |||
| @@ -481,6 +481,9 @@ Terminate @code{save-some-buffers} without any more saving. | |||
| 481 | @item . | 481 | @item . |
| 482 | Save this buffer, then exit @code{save-some-buffers} without even asking | 482 | Save this buffer, then exit @code{save-some-buffers} without even asking |
| 483 | about other buffers. | 483 | about other buffers. |
| 484 | @item M-~ | ||
| 485 | Don't save this buffer, and also mark it as unmodified. | ||
| 486 | This is like the @code{not-modified} command (@pxref{Save Commands}). | ||
| 484 | @item C-r | 487 | @item C-r |
| 485 | View the buffer that you are currently being asked about. When you exit | 488 | View the buffer that you are currently being asked about. When you exit |
| 486 | View mode, you get back to @code{save-some-buffers}, which asks the | 489 | View mode, you get back to @code{save-some-buffers}, which asks the |
| @@ -166,6 +166,11 @@ You can now insert or wrap text with multiple sets of parentheses and | |||
| 166 | other matching delimiters at once with Electric Pair mode, by providing | 166 | other matching delimiters at once with Electric Pair mode, by providing |
| 167 | a prefix argument when inserting one of the delimiters. | 167 | a prefix argument when inserting one of the delimiters. |
| 168 | 168 | ||
| 169 | +++ | ||
| 170 | ** You can now use M-~ during C-x s ('save-some-buffers'). | ||
| 171 | Typing M-~ while saving some buffers means not to save the buffer and | ||
| 172 | also to mark it as unmodified. This is an alternative way to mark a | ||
| 173 | buffer as unmodified which doesn't require switching to that buffer. | ||
| 169 | 174 | ||
| 170 | * Changes in Specialized Modes and Packages in Emacs 31.1 | 175 | * Changes in Specialized Modes and Packages in Emacs 31.1 |
| 171 | 176 | ||
diff --git a/lisp/files.el b/lisp/files.el index 58b5a26a492..c9889f3c765 100644 --- a/lisp/files.el +++ b/lisp/files.el | |||
| @@ -6150,7 +6150,13 @@ Before and after saving the buffer, this function runs | |||
| 6150 | (defvar save-some-buffers--switch-window-callback nil) | 6150 | (defvar save-some-buffers--switch-window-callback nil) |
| 6151 | 6151 | ||
| 6152 | (defvar save-some-buffers-action-alist | 6152 | (defvar save-some-buffers-action-alist |
| 6153 | `((?\C-r | 6153 | `((?\M-~ ,(lambda (buf) |
| 6154 | (with-current-buffer buf | ||
| 6155 | (set-buffer-modified-p nil)) | ||
| 6156 | ;; Return t not to ask about BUF again. | ||
| 6157 | t) | ||
| 6158 | ,(purecopy "skip this buffer and mark it unmodified")) | ||
| 6159 | (?\C-r | ||
| 6154 | ,(lambda (buf) | 6160 | ,(lambda (buf) |
| 6155 | (if (not enable-recursive-minibuffers) | 6161 | (if (not enable-recursive-minibuffers) |
| 6156 | (progn (display-buffer buf) | 6162 | (progn (display-buffer buf) |
| @@ -6257,7 +6263,8 @@ in variables (rather than in buffers).") | |||
| 6257 | 6263 | ||
| 6258 | (defun save-some-buffers (&optional arg pred) | 6264 | (defun save-some-buffers (&optional arg pred) |
| 6259 | "Save some modified file-visiting buffers. Asks user about each one. | 6265 | "Save some modified file-visiting buffers. Asks user about each one. |
| 6260 | You can answer \\`y' or \\`SPC' to save, \\`n' or \\`DEL' not to save, \\`C-r' | 6266 | You can answer \\`y' or \\`SPC' to save, \\`n' or \\`DEL' not to save, |
| 6267 | \\`M-~' not to save and also mark the buffer as unmodified, \\`C-r' | ||
| 6261 | to look at the buffer in question with `view-buffer' before | 6268 | to look at the buffer in question with `view-buffer' before |
| 6262 | deciding, \\`d' to view the differences using | 6269 | deciding, \\`d' to view the differences using |
| 6263 | `diff-buffer-with-file', \\`!' to save the buffer and all remaining | 6270 | `diff-buffer-with-file', \\`!' to save the buffer and all remaining |