unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Adam Porter <adam@alphapapa.net>
To: emacs-devel@gnu.org
Subject: tab-bar: Defining another mouse-button binding?
Date: Tue, 07 Sep 2021 04:37:29 -0500	[thread overview]
Message-ID: <87mtoo6812.fsf@alphapapa.net> (raw)

Hi Juri, et al,

I've been trying to bind other mouse buttons, like mouse-2, to different
commands on the tab-bar tabs, but I've not been able to figure out how.
The comments at the top of tab-bar.el say:

;; The normal global binding for [tab-bar] (below) uses the value of
;; `tab-bar-map' as the actual keymap to define the tab bar.  Modes may
;; either bind items under the [tab-bar] prefix key of the local map to
;; add to the global bar or may set `tab-bar-map' buffer-locally to
;; override it.

I may be just missing some knowledge, but despite my best efforts, I
wasn't able to understand this.  From what I can tell by reading the
source code, the tab-bar tabs are actually stored as a keymap in the
variable tab-bar-map, which is recreated on every redisplay; so that
variable is not actually a user-modifiable keymap that can be used to
assign new actions to clicks on the tabs.

The function `tab-bar--format-tab' (unfortunately, lacking a docstring,
despite its apparently important purpose) seems to construct a
keymap-like or binding-like structure (I'm not an expert on keymaps),
and it inlines interactive lambdas for the mouse click actions (though
it doesn't specify mouse-1, and "C-h k [mouse-1]" on the tab bar
indicates that it's mapped to `ignore', so it's not obvious how that
works).

I guess this unconventional system is necessary for performance reasons,
and it seems to work well.  But does this mean that I can't bind
additional mouse-click actions on the tabs?  Or am I missing something
obvious?  :)

Thanks,
Adam




             reply	other threads:[~2021-09-07  9:37 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-07  9:37 Adam Porter [this message]
2021-09-08 18:12 ` tab-bar: Defining another mouse-button binding? Juri Linkov
2021-09-08 19:00   ` Adam Porter
2021-09-08 19:23     ` Juri Linkov
2021-09-09  7:53     ` Juri Linkov
2021-09-09 17:28       ` Eli Zaretskii
2021-09-09 18:58         ` Juri Linkov
2021-09-09 19:15           ` Eli Zaretskii
2021-09-09 19:19             ` Juri Linkov
2021-09-09 19:38               ` Eli Zaretskii
2021-09-10  6:36                 ` Juri Linkov
2021-09-10  7:05                   ` Eli Zaretskii
2021-09-10 16:19                     ` Juri Linkov
2021-09-10 17:59                       ` Eli Zaretskii
2021-09-11  8:39                       ` martin rudalics
2021-09-11  9:39                         ` Eli Zaretskii
2021-09-11 11:03                           ` Eli Zaretskii

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=87mtoo6812.fsf@alphapapa.net \
    --to=adam@alphapapa.net \
    --cc=emacs-devel@gnu.org \
    /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).