[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Variable for Confirming Killing a Buffer
From: |
Oliver Taylor |
Subject: |
Re: Variable for Confirming Killing a Buffer |
Date: |
Fri, 3 Dec 2021 11:45:35 -0800 |
> On Dec 3, 2021, at 8:58 AM, Lars Ingebrigtsen <larsi@gnus.org> wrote:
>
>> (add-hook 'kill-buffer-query-functions #'buffer-confirm-kill-p)
>
> I'm not sure this is the best way to achieve this -- and it'll get in
> the way of some things that create buffers and then expect to be able to
> kill them off without any queries, I think.
Yes, I would expect that there’s a better way to do this. But as-is this
doesn’t get in the way simply because it requires the buffer-local variable to
be explicitly set.
> Perhaps we should instead bind `C-x k' to a new command that calls
> kill-buffer after (possibly) querying the user instead.
I would imagine the flaw with this is that there are probably a lot of
different ways buffers get killed, and a key binding is only one of them, so it
would only offer a little protection.
> As for the feature itself, I expect people to want to be able to kill
> some buffers without query, anyway, so perhaps it should allow a list of
> major modes that should be queried?
Would this be better accomplished by setting the variable via a mode-hook?