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

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

bug#41343: tab-bar-mode: Close tab on mouse-2 click


From: Juri Linkov
Subject: bug#41343: tab-bar-mode: Close tab on mouse-2 click
Date: Thu, 12 Aug 2021 11:09:35 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)

>> There is the need to apply an additional patch below,
>> because the tab symbol is carried by the event in its
>> OBJECT slot, but some functions expect that the OBJECT
>> slot should contain only (STRING . STRING-POS)
>
> That expectation is according to the documented behavior, so it is
> correct.  I don't quite understand why you need to break the contract
> here.  Can you elaborate where do the deviant values come and why they
> must have a different value form?

Events emitted on the tab-line contain the tab caption
with text properties that help to identify the clicked tab:

 (#<window 391 on buffer.el> tab-line (30 . 10) 29999999
  (#(" buffer.el x" 1 10 (tab #<buffer buffer.el>)) . 4)

The tab-bar could do the same, but how to support existing code
that doesn't add text properties to the tab-bar tab captions
in the tab-bar-format function?

This means that text properties identifying the clicked tab
should be added to the tab caption only after clicking
in the emitted event.  But then the problem that the added
text properties might conflict with the existing text properties
added in the tab-bar-format function.

For example, the tab-bar-format function puts the text property
'close-tab' on the close button.  If the emitted event
will add another property with the same name 'close-tab'
to indicate whether the close button was clicked, it might overwrite
the existing text property on the tab caption.  Maybe then
add the property only on the first character, on the assumption
that it would be less likely to overwrite the existing property.

IOW, with the existing event format, the only way to add event metadata
is to stuff more text properties on the tab caption that already
contains some text properties, such as tab face, and properties
denoting the close button.  But how to do this in a non-conflicting way?





reply via email to

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