* kill-matching-buffers
@ 2007-03-30 14:23 sds
2007-03-30 16:14 ` kill-matching-buffers Chong Yidong
2007-03-31 7:19 ` kill-matching-buffers Richard Stallman
0 siblings, 2 replies; 4+ messages in thread
From: sds @ 2007-03-30 14:23 UTC (permalink / raw)
To: emacs-devel
I find the appended patch quite usefull.
is this functionality already available elsewhere or are there any other
objections to this patch?
--
Sam Steingold (http://www.podval.org/~sds) on Fedora Core release 5 (Bordeaux)
http://mideasttruth.com http://jihadwatch.org http://truepeace.org
http://iris.org.il http://dhimmi.com http://openvotingconsortium.org
Cannot handle the fatal error due to a fatal error in the fatal error handler.
--- files.el 26 Mar 2007 09:30:01 -0400 1.892
+++ files.el 30 Mar 2007 10:19:59 -0400
@@ -4355,6 +4355,14 @@
(message "No files can be recovered from this session now")))
(kill-buffer buffer))))
+(defun kill-buffer-ask (buffer)
+ "Kill buffer if confirmed."
+ (when (yes-or-no-p
+ (format "Buffer %s %s. Kill? " (buffer-name buffer)
+ (if (buffer-modified-p buffer)
+ "HAS BEEN EDITED" "is unmodified")))
+ (kill-buffer buffer)))
+
(defun kill-some-buffers (&optional list)
"Kill some buffers. Asks the user whether to kill each one of them.
Non-interactively, if optional argument LIST is non-nil, it
@@ -4369,14 +4377,21 @@
; if we killed the base buffer.
(not (string-equal name ""))
(/= (aref name 0) ?\s)
- (yes-or-no-p
- (format "Buffer %s %s. Kill? "
- name
- (if (buffer-modified-p buffer)
- "HAS BEEN EDITED" "is unmodified")))
- (kill-buffer buffer)))
+ (kill-buffer-ask buffer)))
(setq list (cdr list))))
\f
+(defun kill-matching-buffers (regexp &optional internal-too)
+ "Kill buffers whose name matches the specified regexp.
+The optional second argument indicates whether to kill internal buffers too."
+ (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)))))
+
+\f
(defun auto-save-mode (arg)
"Toggle auto-saving of contents of current buffer.
With prefix argument ARG, turn auto-saving on if positive, else off."
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: kill-matching-buffers
2007-03-30 14:23 kill-matching-buffers sds
@ 2007-03-30 16:14 ` Chong Yidong
2007-04-02 2:15 ` kill-matching-buffers Miles Bader
2007-03-31 7:19 ` kill-matching-buffers Richard Stallman
1 sibling, 1 reply; 4+ messages in thread
From: Chong Yidong @ 2007-03-30 16:14 UTC (permalink / raw)
To: emacs-devel
sds@janestcapital.com writes:
> I find the appended patch quite usefull.
> is this functionality already available elsewhere or are there any other
> objections to this patch?
Emacs is in pretest---no new features, please.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: kill-matching-buffers
2007-03-30 14:23 kill-matching-buffers sds
2007-03-30 16:14 ` kill-matching-buffers Chong Yidong
@ 2007-03-31 7:19 ` Richard Stallman
1 sibling, 0 replies; 4+ messages in thread
From: Richard Stallman @ 2007-03-31 7:19 UTC (permalink / raw)
To: sds; +Cc: emacs-devel
It might be useful, but now is not the time for new features.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: kill-matching-buffers
2007-03-30 16:14 ` kill-matching-buffers Chong Yidong
@ 2007-04-02 2:15 ` Miles Bader
0 siblings, 0 replies; 4+ messages in thread
From: Miles Bader @ 2007-04-02 2:15 UTC (permalink / raw)
To: emacs-devel
Chong Yidong <cyd@stupidchicken.com> writes:
>> I find the appended patch quite usefull.
>> is this functionality already available elsewhere or are there any other
>> objections to this patch?
>
> Emacs is in pretest---no new features, please.
Anyway, it seems like there are good (and arguably better) ways to do
this in emacs already -- e.g. in ibuffer you can do
%n regexp RET D
or
/n regexp RET t D
In either case you have a chance to adjust the set of files to be
deleted before hitting D.
-Miles
--
"Suppose we've chosen the wrong god. Every time we go to church we're
just making him madder and madder." -- Homer Simpson
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-04-02 2:15 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-30 14:23 kill-matching-buffers sds
2007-03-30 16:14 ` kill-matching-buffers Chong Yidong
2007-04-02 2:15 ` kill-matching-buffers Miles Bader
2007-03-31 7:19 ` kill-matching-buffers Richard Stallman
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.