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.
This commit is contained in:
Sean Whitton 2024-10-03 18:36:45 +08:00
parent 1aeec0db7d
commit cc2ad5c2d1
3 changed files with 17 additions and 2 deletions

View file

@ -481,6 +481,9 @@ Terminate @code{save-some-buffers} without any more saving.
@item .
Save this buffer, then exit @code{save-some-buffers} without even asking
about other buffers.
@item M-~
Don't save this buffer, and also mark it as unmodified.
This is like the @code{not-modified} command (@pxref{Save Commands}).
@item C-r
View the buffer that you are currently being asked about. When you exit
View mode, you get back to @code{save-some-buffers}, which asks the

View file

@ -166,6 +166,11 @@ You can now insert or wrap text with multiple sets of parentheses and
other matching delimiters at once with Electric Pair mode, by providing
a prefix argument when inserting one of the delimiters.
+++
** You can now use M-~ during C-x s ('save-some-buffers').
Typing M-~ while saving some buffers means not to save the buffer and
also to mark it as unmodified. This is an alternative way to mark a
buffer as unmodified which doesn't require switching to that buffer.
* Changes in Specialized Modes and Packages in Emacs 31.1

View file

@ -6150,7 +6150,13 @@ Before and after saving the buffer, this function runs
(defvar save-some-buffers--switch-window-callback nil)
(defvar save-some-buffers-action-alist
`((?\C-r
`((?\M-~ ,(lambda (buf)
(with-current-buffer buf
(set-buffer-modified-p nil))
;; Return t not to ask about BUF again.
t)
,(purecopy "skip this buffer and mark it unmodified"))
(?\C-r
,(lambda (buf)
(if (not enable-recursive-minibuffers)
(progn (display-buffer buf)
@ -6257,7 +6263,8 @@ in variables (rather than in buffers).")
(defun save-some-buffers (&optional arg pred)
"Save some modified file-visiting buffers. Asks user about each one.
You can answer \\`y' or \\`SPC' to save, \\`n' or \\`DEL' not to save, \\`C-r'
You can answer \\`y' or \\`SPC' to save, \\`n' or \\`DEL' not to save,
\\`M-~' not to save and also mark the buffer as unmodified, \\`C-r'
to look at the buffer in question with `view-buffer' before
deciding, \\`d' to view the differences using
`diff-buffer-with-file', \\`!' to save the buffer and all remaining