GNU bug report logs - #20463
25.0.50; New deletion commands in buffer-menu [PATCH]

Previous Next

Package: emacs;

Reported by: Filipp Gunbin <fgunbin <at> fastmail.fm>

Date: Wed, 29 Apr 2015 17:57:02 UTC

Severity: wishlist

Tags: patch, wontfix

Found in version 25.0.50

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Filipp Gunbin <fgunbin <at> fastmail.fm>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 20463 <at> debbugs.gnu.org
Subject: bug#20463: 25.0.50; New deletion commands in buffer-menu [PATCH]
Date: Fri, 08 May 2015 14:18:24 +0300
[Message part 1 (text/plain, inline)]
On 01/05/2015 13:56 -0400, Stefan Monnier wrote:

> As mentioned by someone else, we'd like to bring Ibuffer and buffer-menu
> closer to each other, in terms of code and behavior.
>
> So I'm not opposed to adding the kind of feature you're requesting, but
> as much as possible it should be done in a way that narrows the gap
> between buffer-menu and Ibuffer.  Code reuse would be ideal.

Yes, that should be better than my proposal, I see.

I thought about what I really need once again and I see two cases:

1) kill all log files

2) kill all remote files opened via ssh - they have "/ssh:" in their
names

So I wrote this simple function.  What do you think?

Sorry for the noise if no one is interested.

Filipp

[kill-matching-buffers-file-name.patch (text/x-patch, inline)]
diff --git a/lisp/files.el b/lisp/files.el
index ef6ac7b..a7b989f 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -5827,6 +5827,15 @@ The optional second argument indicates whether to kill internal buffers too."
                  (string-match regexp name))
         (kill-buffer-ask buffer)))))
 
+(defun kill-matching-buffers-file-name (regexp)
+  "Kill buffers whose visited file name matches the specified REGEXP."
+  (interactive "sKill buffers visiting files matching this regular expression: ")
+  (dolist (buffer (buffer-list))
+    (let ((file-name (buffer-file-name buffer)))
+      (when (and file-name 
+                 (string-match regexp file-name))
+        (kill-buffer-ask buffer)))))
+
 
 (defun rename-auto-save-file ()
   "Adjust current buffer's auto save file name for current conditions.

This bug report was last modified 9 years and 146 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.