From: Juri Linkov <juri@linkov.net>
To: Adam Porter <adam@alphapapa.net>
Cc: 70086@debbugs.gnu.org
Subject: bug#70086: Mouse clicks in tab-bar don't call commands bound in keymap properties
Date: Wed, 10 Apr 2024 09:42:30 +0300 [thread overview]
Message-ID: <86cyqxeqa9.fsf@mail.linkov.net> (raw)
In-Reply-To: <6f66d842-7b7c-4a16-bf47-2b3641c3195b@alphapapa.net> (Adam Porter's message of "Fri, 5 Apr 2024 13:41:56 -0500")
[-- Attachment #1: Type: text/plain, Size: 134 bytes --]
> Do you think this could be fixed in time for Emacs 30?
Please try out the following patch. At least it works for your test case.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: tab-bar-global.patch --]
[-- Type: text/x-diff, Size: 2546 bytes --]
diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index cd076664faf..1a80f3d99e7 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -298,9 +298,13 @@ tab-bar--event-to-item
nil otherwise."
(setq tab-bar--dragging-in-progress nil)
(if (posn-window posn)
- (let ((caption (car (posn-string posn))))
- (when caption
- (get-text-property 0 'menu-item caption)))
+ (let* ((caption (car (posn-string posn)))
+ (menu-item (when caption
+ (get-text-property 0 'menu-item caption))))
+ (when (equal menu-item '(global ignore nil))
+ (setf (nth 1 menu-item)
+ (key-binding (vector 'tab-bar last-nonmenu-event) t)))
+ menu-item)
;; Text-mode emulation of switching tabs on the tab bar.
;; This code is used when you click the mouse in the tab bar
;; on a console which has no window system but does have a mouse.
@@ -332,7 +336,7 @@ tab-bar-mouse-down-1
(setq tab-bar--dragging-in-progress t)
;; Don't close the tab when clicked on the close button. Also
;; don't add new tab on down-mouse. Let `tab-bar-mouse-1' do this.
- (unless (or (memq (car item) '(add-tab history-back history-forward))
+ (unless (or (memq (car item) '(add-tab history-back history-forward global))
(nth 2 item))
(if (functionp (nth 1 item))
(call-interactively (nth 1 item))
@@ -347,7 +351,7 @@ tab-bar-mouse-1
(let* ((item (tab-bar--event-to-item (event-start event)))
(tab-number (tab-bar--key-to-number (nth 0 item))))
(cond
- ((and (memq (car item) '(add-tab history-back history-forward))
+ ((and (memq (car item) '(add-tab history-back history-forward global))
(functionp (nth 1 item)))
(call-interactively (nth 1 item)))
((and (nth 2 item) (not (eq tab-number t)))
@@ -468,8 +472,8 @@ tab-bar-touchscreen-begin
(tab-bar-select-tab number))))
;; Cancel the timer.
(cancel-timer timer)))
- ((and (memq (car item) '(add-tab history-back
- history-forward))
+ ((and (memq (car item) '( add-tab history-back
+ history-forward global))
(functionp (cadr item)))
;; This is some kind of button. Wait for the
;; tap to complete and press it.
next prev parent reply other threads:[~2024-04-10 6:42 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 [this message]
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=86cyqxeqa9.fsf@mail.linkov.net \
--to=juri@linkov.net \
--cc=70086@debbugs.gnu.org \
--cc=adam@alphapapa.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).