Subject: Re: bug#70086: Mouse clicks in tab-bar don't call commands bound in keymap properties

From: Juri Linkov <[email-masked]>
Date: Mon, 06 May 2024 19:46:57 +0300

close 70086 30.0.50
thanks

>> Could you please distill this example into a self-contained test case
>> like you did the previous time, that helped a lot.
>
> Ok, the following code seems to demonstrate the problem, with your patch
> applied to tab-bar.el:
> [...]
> Enable both tab-bar-ecm-mode and tab-bar-ecm-mode2.  Then you'll see that,
> regardless of which lighter is clicked in the tab-bar, the lighter for the
> mode that was activated last catches the mouse clicks for both lighters.

Thanks for the comprehensive test case.
So this feature is now implemented by the following patch and pushed:

diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index 2e3d9a6b4ac..26023f24389 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -1119,7 +1119,9 @@ tab-bar-format-global
 then modes that display information on the mode line
 using `global-mode-string' will display the same text
 on the tab bar instead."
-  `((global menu-item ,(format-mode-line global-mode-string) ignore)))
+  (mapcar (lambda (string)
+            `(global menu-item ,(format-mode-line string) ignore))
+          global-mode-string))