From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Adam Porter Newsgroups: gmane.emacs.devel Subject: tab-bar: Defining another mouse-button binding? Date: Tue, 07 Sep 2021 04:37:29 -0500 Message-ID: <87mtoo6812.fsf@alphapapa.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12968"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Sep 07 11:39:02 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mNXZF-0003Di-UM for ged-emacs-devel@m.gmane-mx.org; Tue, 07 Sep 2021 11:39:01 +0200 Original-Received: from localhost ([::1]:58032 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mNXZE-0001H3-Eh for ged-emacs-devel@m.gmane-mx.org; Tue, 07 Sep 2021 05:39:00 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60834) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mNXXw-0000YX-6L for emacs-devel@gnu.org; Tue, 07 Sep 2021 05:38:11 -0400 Original-Received: from ciao.gmane.io ([116.202.254.214]:58654) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mNXXu-0007Ox-Nn for emacs-devel@gnu.org; Tue, 07 Sep 2021 05:37:39 -0400 Original-Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1mNXXr-0001YD-GI for emacs-devel@gnu.org; Tue, 07 Sep 2021 11:37:35 +0200 X-Injected-Via-Gmane: http://gmane.org/ Received-SPF: pass client-ip=116.202.254.214; envelope-from=ged-emacs-devel@m.gmane-mx.org; helo=ciao.gmane.io X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.249, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:274221 Archived-At: 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