all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eduardo Ochs <eduardoochs@gmail.com>
To: Tassilo Horn <tsdh@gnu.org>
Cc: Help GNU Emacs <help-gnu-emacs@gnu.org>
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	[thread overview]
Message-ID: <CADs++6gEjLZ46wURmpAY9oaEutXELTZB4mMN6dici81j6HqX9g@mail.gmail.com> (raw)
In-Reply-To: <874j33bzrd.fsf@gnu.org>

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	other threads:[~2024-12-16 12:25 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-16  6:59 Is there any local variable to avoid asking me to save buffer on kill-buffer? Jean Louis
2024-12-16  7:14 ` Jean Louis
2024-12-16 12:04   ` Tassilo Horn
2024-12-16 12:25     ` Eduardo Ochs [this message]
2024-12-16 15:00 ` Stefan Monnier via Users list for the GNU Emacs text editor
2024-12-16 16:13   ` Jean Louis
2024-12-16 19:39     ` Suhail Singh
2024-12-16 21:02       ` Jean Louis
2024-12-16 21:26         ` Suhail Singh
2024-12-17  4:05           ` Jean Louis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CADs++6gEjLZ46wURmpAY9oaEutXELTZB4mMN6dici81j6HqX9g@mail.gmail.com \
    --to=eduardoochs@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=tsdh@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.