unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Adam Porter <adam@alphapapa.net>
To: Juri Linkov <juri@linkov.net>
Cc: control@debbugs.gnu.org, 70086@debbugs.gnu.org
Subject: bug#70086: Mouse clicks in tab-bar don't call commands bound in keymap properties
Date: Fri, 3 May 2024 23:15:03 -0500	[thread overview]
Message-ID: <cd55aa40-1101-4461-9b21-789f4eca732b@alphapapa.net> (raw)
In-Reply-To: <86wmobbev6.fsf@mail.linkov.net>

> 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:


     (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))))

     (defvar tab-bar-ecm-keymap2
       (let ((map (make-sparse-keymap)))
	(define-key map [tab-bar mouse-1] (lambda (&rest _)
					    (interactive)
					    (message "tab-bar-ecm-lighter2 clicked with mouse-1")))
	map))

     (defvar tab-bar-ecm-lighter2 "TAB-BAR-ECM-LIGHTER2 ")

     (define-minor-mode tab-bar-ecm-mode2 "DOCSTRING"
       :global t
       (let ((lighter `(tab-bar-ecm-mode2
		       (:propertize tab-bar-ecm-lighter2 keymap ,tab-bar-ecm-keymap2))))
	(if tab-bar-ecm-mode2
	    (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))))


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.





  reply	other threads:[~2024-05-04  4: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
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 [this message]
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=cd55aa40-1101-4461-9b21-789f4eca732b@alphapapa.net \
    --to=adam@alphapapa.net \
    --cc=70086@debbugs.gnu.org \
    --cc=control@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).