GNU bug report logs - #70086
Mouse clicks in tab-bar don't call commands bound in keymap properties

Previous Next

Package: emacs;

Reported by: Adam Porter <adam <at> alphapapa.net>

Date: Sat, 30 Mar 2024 02:26:01 UTC

Severity: normal

Fixed in version 30.0.50

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Adam Porter <adam <at> alphapapa.net>
To: Juri Linkov <juri <at> linkov.net>
Cc: control <at> debbugs.gnu.org, 70086 <at> 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
> 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.




This bug report was last modified 1 year and 17 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.