emacs-devel
[Top][All Lists]
Advanced

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

Re: kill-matching-buffers without confirmation


From: R. Diez
Subject: Re: kill-matching-buffers without confirmation
Date: Tue, 23 May 2017 06:28:23 +0000 (UTC)


> You are defining _your own_ command. Just define it directly.
> The code to do that is trivial.

I think you are misguided here. You seem to believe that Emacs users are 
confident Elisp programmers.

This is the source code of kill-matching-buffers:



(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)))))



It is not clear to me what internal buffers are, or why some of them could have 
an empty name. I cannot see a reason why I, as a regular user, should care.



> For one thing, you can just copy the existing code of
>`kill-matching-buffers' and substitute `kill-buffer' for `kill-buffer-ask'.

This is really bad advice. If the next version of Emacs changes the 
implementation of that routine, my copy will miss those changes.


My use case is not actually interactive. I just want to close the buffers that 
ediff automatically creates from its exit hook, but I have other scenarios 
where other things automatically load buffers that I no longer want. I do that 
kind of clean-up in a hook, no interaction required.


> [What Emacs should offer instead is a way for `C-x k' to act (by hitting

No, this is not what I need. I do not want interactive selection or fuzzy 
matches. I know exactly what pattern to use. What you are describing is a 
separate enhancement for interactive usage.


[Obligatory rant follows]

I am just asking for a little convenience function. It is almost what 
kill-matching-buffers does, just without hard-coded confirmation.

This is a recurrent pattern with Emacs. Everything is so complicated, and there 
is so much discussion.

There are other open-source projects which do not advice their users to create 
a bug themselves after posting a request, or which do not tell them to write 
their own code for each little thing. If a small improvement helps the regular 
user in his daily life, they just do it! The mere existence of the Stack 
Overflow question and the first replies here with cl-letf  etc. should make it 
obvious that such a convenience function/flag would help.


Regards,
  rdiez


reply via email to

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