From: Juri Linkov <juri@linkov.net>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 62575@debbugs.gnu.org, Claudio Grondi <claudio.grondi@freenet.de>
Subject: bug#62575: 29.0.60; Tabs are not showing the right names of the buffers
Date: Sun, 02 Apr 2023 09:48:58 +0300 [thread overview]
Message-ID: <86355iixt1.fsf@mail.linkov.net> (raw)
In-Reply-To: <83sfdjy9va.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 01 Apr 2023 17:07:05 +0300")
>> The bug: the third Tab still keeps its .emacs label, the click on the
>> second Tab labeled .emacs did not show the .emacs file, but the buffer
>> *Messages*.
>
> After looking at the code, I'm not sure this is a bug. The tab names
> are just labels, although they are conveniently set to the name of the
> buffer in the window to be selected when the tab is current. But
> otherwise they are just labels. When you click on the tab, its name
> is updated to reflect the buffer shown in the selected window, so I
> think Emacs is behaving correctly, although it might be a bit
> unexpected.
>
> Juri, am I right? If not, where is the code that's supposed to update
> the labels when some buffers or windows are deleted or renamed?
Right, tab names are just labels, or by another analogy are "bookmarks".
It was a design decision to keep labels even after a buffer is killed,
so the users know what buffer was displayed in the tab created to
display that buffer.
What we could do is to help to create additional code that could be
used to update tab names according to user wishes.
But the problem is that there are too many ways to do this,
so the implementation logic is too fuzzy and not well defined.
Here are some considerations that could be took into account:
1. First there is no need to update tabs with names set explicitly
by 'tab-rename' (C-x t r).
2. Also no need to update a tab name when non-current buffers
are killed on a window configuration saved to the tab,
in case when tab-bar-tab-name-function is unchanged from
its default value tab-bar-tab-name-current. However,
when it's customized to tab-bar-tab-name-all, then
killing any buffer on the window configuration can change
the tab name. There are other values that may or may not
change the tab name after the buffer is killed.
3. It seems the reported wish was to rename the tab
after the buffer was killed. But I imagine some users
instead might prefer to automatically close all tabs that
displayed the killed buffer. This also makes sense.
4. As noted by Ruijie, the code should react not only
to killing a buffer, but also to renaming a buffer.
This means that instead of using kill-buffer-hook,
it should rely on buffer-list-update-hook, but
the problem is that buffer-list-update-hook is
not called with a buffer name, so need to develop
much more complicated code.
I invite Claudio and anyone to try the code I wrote
for bug#52019 and bug#60096 as a staring point.
Then after fulfilling the expectations, it could be
later added to tab-bar.el as an option:
;; Visit affected tabs to update their names:
(add-hook 'kill-buffer-hook
(lambda ()
(let ((tabs (reverse
(mapcar (lambda (tab) (1+ (alist-get 'index tab)))
(tab-bar-get-buffer-tab nil t nil t)))))
(run-with-timer
0 nil
(lambda (tabs) (dolist (tab tabs) (tab-bar-select-tab tab)))
tabs))))
next prev parent reply other threads:[~2023-04-02 6:48 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-31 21:06 bug#62575: 29.0.60; Tabs are not showing the right names of the buffers Claudio Grondi
2023-04-01 5:37 ` Eli Zaretskii
2023-04-01 11:19 ` Claudio Grondi
2023-04-01 11:38 ` Ruijie Yu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-04-01 12:28 ` Claudio Grondi
2023-04-01 12:32 ` Eli Zaretskii
2023-04-01 11:55 ` Eli Zaretskii
2023-04-01 14:07 ` Eli Zaretskii
2023-04-02 6:48 ` Juri Linkov [this message]
2023-04-02 15:26 ` Claudio Grondi
2023-04-02 16:29 ` Juri Linkov
2023-04-02 21:45 ` Claudio Grondi
2023-04-03 6:30 ` Juri Linkov
2023-04-03 12:37 ` Claudio Grondi
2023-04-03 16:11 ` Juri Linkov
2023-04-03 18:06 ` Claudio Grondi
2023-04-04 6:56 ` Juri Linkov
2024-05-02 18:12 ` Juri Linkov
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=86355iixt1.fsf@mail.linkov.net \
--to=juri@linkov.net \
--cc=62575@debbugs.gnu.org \
--cc=claudio.grondi@freenet.de \
--cc=eliz@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 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).