emacs-diffs
[Top][All Lists]
Advanced

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

master 117f90865ad: Add new command `kill-matching-buffers-no-ask' (bug#


From: Andrea Corallo
Subject: master 117f90865ad: Add new command `kill-matching-buffers-no-ask' (bug#60714)
Date: Fri, 20 Jan 2023 05:13:48 -0500 (EST)

branch: master
commit 117f90865adca03eab84778db0370ddc05ba8ae7
Author: Andrea Corallo <andrea.corallo@arm.com>
Commit: Andrea Corallo <andrea.corallo@arm.com>

    Add new command `kill-matching-buffers-no-ask' (bug#60714)
    
    * lisp/files.el (kill-matching-buffers-no-ask): New function.
    * etc/NEWS: Announce `kill-matching-buffers-no-ask'.
---
 etc/NEWS      | 4 ++++
 lisp/files.el | 9 +++++++++
 2 files changed, 13 insertions(+)

diff --git a/etc/NEWS b/etc/NEWS
index fc8a3ac66a0..8df540f6d8d 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -53,6 +53,10 @@ trash when deleting.  Default is nil.
 
 * Editing Changes in Emacs 30.1
 
+** New command 'kill-matching-buffers-no-ask'
+Kills buffers whose name matches a regexp without asking for
+confirmation.
+
 ** New helper variable 'transpose-sexps-function'.
 Emacs now can set this variable to customize the behavior of the
 'transpose-sexps' function.
diff --git a/lisp/files.el b/lisp/files.el
index 29ba523fa69..d308e99804d 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -7112,6 +7112,15 @@ each buffer, unless NO-ASK is non-nil."
                  (string-match regexp name))
         (funcall (if no-ask 'kill-buffer 'kill-buffer-ask) buffer)))))
 
+(defun kill-matching-buffers-no-ask (regexp &optional internal-too)
+  "Kill buffers whose name matches the specified REGEXP.
+Ignores buffers whose name starts with a space, unless optional
+prefix argument INTERNAL-TOO is non-nil.  Equivalent to
+`kill-matching-buffers' but never ask before killing each
+buffer."
+  (interactive "sKill buffers matching this regular expression: \nP")
+  (kill-matching-buffers regexp internal-too t))
+
 
 (defun rename-auto-save-file ()
   "Adjust current buffer's auto save file name for current conditions.



reply via email to

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