[Top][All Lists]

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

RE: kill-matching-buffers without confirmation

From: Drew Adams
Subject: RE: kill-matching-buffers without confirmation
Date: Mon, 22 May 2017 15:21:27 -0700 (PDT)

> Could someone please add a clean way for 'kill-matching-buffers' to not ask
> for confirmation?...
> I am tired of overriding 'kill-buffer-ask' with flet as suggested there,
> and then seeing this warning:
>   Warning (bytecomp): ‘flet’ is an obsolete macro (as of 24.3); use either
>   ‘cl-flet’ or ‘cl-letf’.
> And then remembering that cl-flet does not work, and it gets complicated
> with Lisp macros, dynamic something, etc. I am no Elisp expert.

The suggestions to wrap `kill-matching-buffers' with `cl-letf' or `flet'
are overkill - misguided, IMHO.

You are defining _your own_ command. Just define it directly.  The code to
do that is trivial.  For one thing, you can just copy the existing code of
`kill-matching-buffers' and substitute `kill-buffer' for `kill-buffer-ask'.

I don't think that Emacs needs either (1) a new, non-confirming command for
this or (2) a variable to inhibit confirmation by `kill-matching-buffers'.

I don't even think that Emacs needs commands `kill-matching-buffers' and
`kill-some-buffers' at all, for that matter.


[What Emacs should offer instead is a way for `C-x k' to act (by hitting
a key) on *each* completion of your input.  And ways to match buffer names
better, possibly choosing how on the fly: substring, regexp, fuzzy.

And a way to progressively narrow the set of matches.  And a way to act on
specific matches but not all.  And a way to act on non-matches.  And a way
to filter buffer-name matches to keep or remove those for modified buffers.

(In Icicles, you use `C-x k', type a regexp, complete, and hit `C-!'
to kill all of the matches.  To filter out the modified buffers, just
use `C-x * -' before hitting `C-!'.  So that's `C-x k TAB C-x * -'.
And you can use `C-M-down' to see info about each buffer, including
whether it is modified.  And the same keys work for other commands
that use buffer-name completion, e.g., `C-x 4 b'.)]

reply via email to

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