From: Filipp Gunbin <fgunbin@fastmail.fm>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 20463@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 [thread overview]
Message-ID: <m23837wc5b.fsf@fastmail.fm> (raw)
In-Reply-To: <jwv7fss2nft.fsf-monnier+emacsbugs@gnu.org> (Stefan Monnier's message of "Fri, 01 May 2015 13:56:19 -0400")
[-- Attachment #1: Type: text/plain, Size: 718 bytes --]
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
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: kill-matching-buffers-file-name.patch --]
[-- Type: text/x-patch, Size: 816 bytes --]
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)))))
+
\f
(defun rename-auto-save-file ()
"Adjust current buffer's auto save file name for current conditions.
next prev parent reply other threads:[~2015-05-08 11:18 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-29 17:55 bug#20463: 25.0.50; New deletion commands in buffer-menu [PATCH] Filipp Gunbin
2015-04-30 7:12 ` Glenn Morris
2015-04-30 16:06 ` Filipp Gunbin
2015-05-01 1:43 ` Stefan Monnier
2015-05-01 2:05 ` Filipp Gunbin
2015-05-01 2:20 ` Alexis
2015-05-01 17:56 ` Stefan Monnier
2015-05-08 11:18 ` Filipp Gunbin [this message]
2016-02-23 10:38 ` Lars Ingebrigtsen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m23837wc5b.fsf@fastmail.fm \
--to=fgunbin@fastmail.fm \
--cc=20463@debbugs.gnu.org \
--cc=monnier@iro.umontreal.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).