|
From: | Adam Porter |
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 |
User-agent: | Mozilla Thunderbird |
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.
[Prev in Thread] | Current Thread | [Next in Thread] |