From: Juri Linkov <juri@linkov.net>
To: 75949@debbugs.gnu.org
Cc: martin rudalics <rudalics@gmx.at>
Subject: bug#75949: kill-buffer-quit-windows breaks kill-buffer-hook
Date: Thu, 30 Jan 2025 19:04:09 +0200 [thread overview]
Message-ID: <87cyg4wv1i.fsf@mail.linkov.net> (raw)
Please try to evaluate in the *scratch* buffer:
(progn
(setopt kill-buffer-quit-windows t)
(view-echo-area-messages)
(pop-to-buffer-same-window (get-buffer-create "foo"))
(add-hook 'kill-buffer-hook (lambda () (message "%S" (current-buffer))))
(add-hook 'kill-buffer-hook (lambda () (kill-buffer (get-buffer "bar")))
nil t)
(display-buffer (get-buffer-create "bar"))
(switch-to-buffer (get-buffer "*scratch*"))
(kill-buffer (get-buffer "foo")))
Then observe in the *Messages* buffer that the hook 'kill-buffer-hook'
is run in the *scratch* buffer that is never killed.
Afterwards try to set kill-buffer-quit-windows back to the default value nil,
and evaluate again. Then everything is correct.
It seems that kill-buffer-quit-windows somehow messes up the current buffer
while running 'kill-buffer-hook'.
This is a distilled test case from the real problem
in treesit--explorer-kill-explorer-buffer
that prevents (add-hook 'kill-buffer-hook #'save-place-to-alist)
from saving places in the right buffer.
next reply other threads:[~2025-01-30 17:04 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-30 17:04 Juri Linkov [this message]
2025-01-31 8:49 ` bug#75949: kill-buffer-quit-windows breaks kill-buffer-hook martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2025-02-01 17:25 ` Juri Linkov
2025-02-02 8:52 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2025-02-03 7:52 ` Juri Linkov
2025-02-03 8:33 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87cyg4wv1i.fsf@mail.linkov.net \
--to=juri@linkov.net \
--cc=75949@debbugs.gnu.org \
--cc=rudalics@gmx.at \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).