all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* tab-bar: Defining another mouse-button binding?
@ 2021-09-07  9:37 Adam Porter
  2021-09-08 18:12 ` Juri Linkov
  0 siblings, 1 reply; 17+ messages in thread
From: Adam Porter @ 2021-09-07  9:37 UTC (permalink / raw)
  To: emacs-devel

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




^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2021-09-11 11:03 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-09-07  9:37 tab-bar: Defining another mouse-button binding? Adam Porter
2021-09-08 18:12 ` 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

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.