aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean Whitton2024-10-03 18:36:45 +0800
committerSean Whitton2024-10-03 18:37:01 +0800
commitcc2ad5c2d1508236e79658936e7c7f532ddba586 (patch)
tree51f4f1c39457335e547246d177e0750de9e9a4f6
parent1aeec0db7d206e7664ba68fc5b6720f0535c2978 (diff)
downloademacs-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.texi3
-rw-r--r--etc/NEWS5
-rw-r--r--lisp/files.el11
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 .
482Save this buffer, then exit @code{save-some-buffers} without even asking 482Save this buffer, then exit @code{save-some-buffers} without even asking
483about other buffers. 483about other buffers.
484@item M-~
485Don't save this buffer, and also mark it as unmodified.
486This is like the @code{not-modified} command (@pxref{Save Commands}).
484@item C-r 487@item C-r
485View the buffer that you are currently being asked about. When you exit 488View the buffer that you are currently being asked about. When you exit
486View mode, you get back to @code{save-some-buffers}, which asks the 489View mode, you get back to @code{save-some-buffers}, which asks the
diff --git a/etc/NEWS b/etc/NEWS
index abe316547aa..15d5631e144 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -166,6 +166,11 @@ You can now insert or wrap text with multiple sets of parentheses and
166other matching delimiters at once with Electric Pair mode, by providing 166other matching delimiters at once with Electric Pair mode, by providing
167a prefix argument when inserting one of the delimiters. 167a prefix argument when inserting one of the delimiters.
168 168
169+++
170** You can now use M-~ during C-x s ('save-some-buffers').
171Typing M-~ while saving some buffers means not to save the buffer and
172also to mark it as unmodified. This is an alternative way to mark a
173buffer 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.
6260You can answer \\`y' or \\`SPC' to save, \\`n' or \\`DEL' not to save, \\`C-r' 6266You 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'
6261to look at the buffer in question with `view-buffer' before 6268to look at the buffer in question with `view-buffer' before
6262deciding, \\`d' to view the differences using 6269deciding, \\`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