emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master cc2ad5c2d15: New M-~ entry in save-some-buffers-action-alist


From: Sean Whitton
Subject: master cc2ad5c2d15: New M-~ entry in save-some-buffers-action-alist
Date: Thu, 3 Oct 2024 06:37:03 -0400 (EDT)

branch: master
commit cc2ad5c2d1508236e79658936e7c7f532ddba586
Author: Sean Whitton <spwhitton@spwhitton.name>
Commit: Sean Whitton <spwhitton@spwhitton.name>

    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.
---
 doc/emacs/files.texi |  3 +++
 etc/NEWS             |  5 +++++
 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.
 @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
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
 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
 
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
 (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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]