From: Adam Porter <adam@alphapapa.net>
To: Juri Linkov <juri@linkov.net>
Cc: 70086@debbugs.gnu.org
Subject: bug#70086: Mouse clicks in tab-bar don't call commands bound in keymap properties
Date: Sun, 31 Mar 2024 11:15:06 -0500 [thread overview]
Message-ID: <6393275a-0009-46f0-9eff-c1149c2e0ee4@alphapapa.net> (raw)
In-Reply-To: <86ttknd3kd.fsf@mail.linkov.net>
Hi Juri,
On 3/30/24 13:16, Juri Linkov wrote:
>> In my listen.el package on GNU ELPA, I'm trying to make mouse clicks in the
>> `global-mode-string' construct work when `mode-line-misc-info' is shown in
>> the tab-bar by including `tab-bar-format-global' in `tab-bar-format'. I'm
>> including this construct in the `global-mode-string':
>>
>>
>> `(listen-mode (:propertize listen-mode-lighter
>> keymap ,listen-mode-lighter-map))
>
> Thanks for the request. If possible could you send a minimal test case
> to see what exactly do you need.
Sure, the following code in a clean Emacs config seems to demonstrate
the problem:
(require 'cl-lib)
(defvar tab-bar-ecm-keymap
(let ((map (make-sparse-keymap)))
(define-key map [tab-bar mouse-1] (lambda (&rest _)
(interactive)
(message "tab-bar-ecm-lighter
clicked with mouse-1")))
map))
(defvar tab-bar-ecm-lighter "TAB-BAR-ECM-LIGHTER")
(define-minor-mode tab-bar-ecm-mode "DOCSTRING"
:global t
(let ((lighter `(tab-bar-ecm-mode
(:propertize tab-bar-ecm-lighter keymap
,tab-bar-ecm-keymap))))
(if tab-bar-ecm-mode
(progn
(cl-pushnew lighter global-mode-string :test #'equal)
(unless (memq 'tab-bar-format-global tab-bar-format)
(cl-callf append tab-bar-format '(tab-bar-format-global))))
(cl-callf2 remove lighter global-mode-string))))
Evaluate that code and then enable `tab-bar-mode' and
`tab-bar-ecm-mode'. Then you can see that "C-h k" followed by a click
on the "TAB-BAR-ECM-LIGHTER" text in the tab-bar shows that the
anonymous command is bound to that sequence, yet clicking the text
doesn't call it.
> And the same should work on `tab-line-format' as well.
I haven't tried that, but sure, sounds good to me. :)
> Indeed, events on the tab-bar have a different design where
> `tab-bar--event-to-item' should be used to get a bound command.
> You can see an example in `tab-bar-mouse-down-1' that uses
> (if (functionp (nth 1 item)) (call-interactively (nth 1 item))
> to call an arbitrary command.
I see, thanks.
--Adam
next prev parent reply other threads:[~2024-03-31 16:15 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-30 2:25 bug#70086: Mouse clicks in tab-bar don't call commands bound in keymap properties Adam Porter
2024-03-30 18:16 ` Juri Linkov
2024-03-30 18:56 ` Eli Zaretskii
2024-03-31 16:15 ` Adam Porter [this message]
2024-04-05 16:29 ` Juri Linkov
2024-04-05 18:41 ` Adam Porter
2024-04-10 6:42 ` Juri Linkov
2024-05-02 17:55 ` Juri Linkov
2024-05-03 5:45 ` Adam Porter
2024-05-03 6:18 ` Juri Linkov
2024-05-04 4:15 ` Adam Porter
2024-05-05 6:49 ` Juri Linkov
2024-05-06 16:46 ` 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=6393275a-0009-46f0-9eff-c1149c2e0ee4@alphapapa.net \
--to=adam@alphapapa.net \
--cc=70086@debbugs.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 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).