all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Claudio Grondi <claudio.grondi@freenet.de>
To: Juri Linkov <juri@linkov.net>, Eli Zaretskii <eliz@gnu.org>
Cc: 62575@debbugs.gnu.org
Subject: bug#62575: 29.0.60; Tabs are not showing the right names of the buffers
Date: Sun, 2 Apr 2023 17:26:09 +0200	[thread overview]
Message-ID: <3e479430-7e02-67de-8bb5-663a2769e6c0@freenet.de> (raw)
In-Reply-To: <86355iixt1.fsf@mail.linkov.net>


 From what I understand reading Juris response the core of the problem 
and reason for the issue is lack of unambiguous concept of what a Tab 
Bar is and what the Tabs in the Tab Bar represent.

On one side the Tab Bar is considered as an aid helping to switch view 
to another buffer by clicking on a Tab, on the other side what is 
actually shown after clicking a Tab Bar is not a visualization of a 
buffer but visualization of what is sometimes called "root window", 
sometimes "window configuration", sometimes "window" and sometimes a 
"frame" (it is the messing around with concepts what makes it so hard to 
know what is right and what is wrong).

To my current state of knowledge the Tabs in the Tab Bar represent in 
the context of Emacs what in context of an OS Desktop is called 
Workspace. The only difference of an Emacs Tab to a Workspace is that 
the Emacs Tab does not allow empty space not filled with a window 
showing visualization of some elisp object called a buffer.

It is on one side a mess to call the file saving Emacs state 
.emacs.desktop suggesting that it is a desktop saved and not a 'frame' 
or a 'set of window configurations', on the other side in my eyes 
already the right wording for saving the state of all of the Workspaces 
called Tabs in a Tab Bar.

My suggestion in this context would be not to work on a patch or on 
adding one more option, but to fix the problem with lack of an 
unambiguous concepts for 'frame', 'window', 'root window', 'window 
configuration', 'tab in tab-bar' first. I am aware that doing this would 
require to rewrite almost the entire Emacs documentation - but it 
appears in my eyes worth it considering the future benefits of a clear 
structure and well defined vocabulary to use while speaking about Emacs.

Anyway: if you click a button labeled "OK" you expect that the result of 
it would be confirmation and not a change of a button label to "Cancel". 
If you click a Menu item labeled "Open File" you expect that it will 
result in a process of opening a file and not in changing the label 
"Open File" to "Close File" or another one. Generally you expect by 
clicking on a button or a Tab or elsewhere that it would result in what 
is stated as text labeling it.

How much of overall confusion is needed in order to not be able to see 
such an obvious fact? Considering keeping a label on a button which text 
does not represent the action which will be triggered by clicking it a 
"design decision" worth to be preserved appears in my eyes just insane. 
How does it come you don't see it the same way I do???

Am ** I ** insane expecting that clicking a button labeled "show me 
buffer X" will show me buffer X???

---

By the way:

I have placed the below provided code into my Emacs initialization file 
and the issue is gone. On killing the buffer the labels on Tabs in the 
Tab Bar are updated. Thanks :) .

What still remains is the issue with renaming a buffer, enforcing my 
believe that fixing the problem with lack of a well unambiguous 
concept/definition of what a buffer, a tab-bar, a window, a tab, etc. 
actually represent will fix this and all similar issues just as a 
side-effect.


On 4/2/23 08:48, Juri Linkov wrote:
>>> 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))))





  reply	other threads:[~2023-04-02 15:26 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
2023-04-02 15:26         ` Claudio Grondi [this message]
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

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

  git send-email \
    --in-reply-to=3e479430-7e02-67de-8bb5-663a2769e6c0@freenet.de \
    --to=claudio.grondi@freenet.de \
    --cc=62575@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=juri@linkov.net \
    /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.