all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#27286: 25.2; kill-matching-buffers without confirmation
       [not found] <1078456524.8697835.1496933777333.ref@mail.yahoo.com>
@ 2017-06-08 14:56 ` R. Diez
  2017-06-20  1:35   ` Glenn Morris
       [not found]   ` <handler.27286.D27286.149792256214044.notifdone@debbugs.gnu.org>
  0 siblings, 2 replies; 3+ messages in thread
From: R. Diez @ 2017-06-08 14:56 UTC (permalink / raw)
  To: 27286

Hi there:

Please add a clean way for 'kill-matching-buffers' to not ask for
confirmation. I need this for non-interactive usage.

The work-around usually proposed involves using 'flet' or some other hack, like
copying and modifying an Emacs internal function (which could change in
the future, thus breaking your copy).

I was advised to create this bug so that it "gets more traction".

I have already discussed this enhancement with the Emacs developers, and
I think that there was consensus that this feature would be useful. More detailed
information is in this mailing list thread:

Mailing list: emacs-devel
Subject: kill-matching-buffers without confirmation
Date: Mon, 22 May 2017 16:28:10 +0000 (UTC)
URL: https://lists.gnu.org/archive/html/emacs-devel/2017-05/msg00625.html

Many thanks in advance,
  rdiez





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#27286: 25.2; kill-matching-buffers without confirmation
  2017-06-08 14:56 ` bug#27286: 25.2; kill-matching-buffers without confirmation R. Diez
@ 2017-06-20  1:35   ` Glenn Morris
       [not found]   ` <handler.27286.D27286.149792256214044.notifdone@debbugs.gnu.org>
  1 sibling, 0 replies; 3+ messages in thread
From: Glenn Morris @ 2017-06-20  1:35 UTC (permalink / raw)
  To: 27286-done

Version: 26.1

I applied the following, though I was tempted to say that this function
should only be used interactively, and that if you want some other
behaviour, you should code your own function.

commit 70d01da
Date:   Mon Jun 19 21:31:50 2017 -0400

    kill-matching-buffers to optionally not confirm
    
    * lisp/files.el (kill-matching-buffers):
    Add option to not confirm killing.  (Bug#27286)

diff --git a/lisp/files.el b/lisp/files.el
index 2930f30..06f49bb 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -6077,16 +6077,18 @@ specifies the list of buffers to kill, asking for approval for each one."
 	   (kill-buffer-ask buffer)))
     (setq list (cdr list))))
 
-(defun kill-matching-buffers (regexp &optional internal-too)
+(defun kill-matching-buffers (regexp &optional internal-too no-ask)
   "Kill buffers whose name matches the specified REGEXP.
-The optional second argument indicates whether to kill internal buffers too."
+Ignores buffers whose name starts with a space, unless optional
+prefix argument INTERNAL-TOO is non-nil.  Asks before killing
+each buffer, unless NO-ASK is non-nil."
   (interactive "sKill buffers matching this regular expression: \nP")
   (dolist (buffer (buffer-list))
     (let ((name (buffer-name buffer)))
       (when (and name (not (string-equal name ""))
                  (or internal-too (/= (aref name 0) ?\s))
                  (string-match regexp name))
-        (kill-buffer-ask buffer)))))
+        (funcall (if no-ask 'kill-buffer 'kill-buffer-ask) buffer)))))
 
 \f
 (defun rename-auto-save-file ()





^ permalink raw reply related	[flat|nested] 3+ messages in thread

* bug#27286: closed (Re: bug#27286: 25.2; kill-matching-buffers without confirmation)
       [not found]   ` <handler.27286.D27286.149792256214044.notifdone@debbugs.gnu.org>
@ 2017-06-23 12:32     ` R. Diez
  0 siblings, 0 replies; 3+ messages in thread
From: R. Diez @ 2017-06-23 12:32 UTC (permalink / raw)
  To: 27286@debbugs.gnu.org

Cool, many thanks!





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-06-23 12:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1078456524.8697835.1496933777333.ref@mail.yahoo.com>
2017-06-08 14:56 ` bug#27286: 25.2; kill-matching-buffers without confirmation R. Diez
2017-06-20  1:35   ` Glenn Morris
     [not found]   ` <handler.27286.D27286.149792256214044.notifdone@debbugs.gnu.org>
2017-06-23 12:32     ` bug#27286: closed (Re: bug#27286: 25.2; kill-matching-buffers without confirmation) R. Diez

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.