help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Is there any local variable to avoid asking me to save buffer on kil


From: Eduardo Ochs
Subject: Re: Is there any local variable to avoid asking me to save buffer on kill-buffer?
Date: Mon, 16 Dec 2024 09:25:25 -0300

On Mon, 16 Dec 2024 at 09:04, Tassilo Horn <tsdh@gnu.org> wrote:
>
> Jean Louis <bugs@gnu.support> writes:
>
> > (defun rcd-temp-buffer-kill-current ()
> >   "Kill current buffer without asking."
> >   (interactive)
> >   (let ((buffer-name (buffer-name (current-buffer))))
> >     (kill-matching-buffers-no-ask (regexp-quote buffer-name))
> >     (message "Killed: " buffer-name)))
> >
> > I see that above attempt is again asking me, but function is called
> > "no-ask". Is that a bug?
>
> Not really, but a bit strange maybe.  kill-matching-buffers-no-ask calls
> kill-matching-buffers with no-ask arg set to t.  That results in buffers
> being killed with kill-buffer instead of kill-buffer-ask.  The latter
> would require confirmation for any buffer to be killed.
>
> However, kill-buffer itself will query anyhow in certain cases,
> especially when you have unsaved changes in the buffer which you
> probably have.
>
> So it depends on how one interprets "no-ask".  The current
> interpretation seems to be "don't ask unless you might lose data" in
> contrast to "never" which you seem to expect.
>
> HTH,
> Tassilo


Hi Jean,
I use this in eev, bound to `M-k':

  (defun ee-kill-this-buffer ()
    "Kill the current buffer with fewer warnings than `kill-this-buffer'.
  See: (find-eev-quick-intro \"3. Elisp hyperlinks\" \"go back\" \"`M-k'\")
  and: (find-eval-intro \"`M-k'\")"
    (interactive)
    (let ((kill-buffer-query-functions nil))
      (kill-this-buffer)))

it is simple and IIRC it only asks for confirmation when a buffer
has a file associated to it and it is marked as modified...

  Cheers,
    Eduardo Ochs
    http://anggtwu.net/emacsconf2024.html



reply via email to

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