[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Keybinding for finding definition by mouse

From: Tobias Gerdin
Subject: Keybinding for finding definition by mouse
Date: Sun, 8 Jul 2018 22:06:18 +0200
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 Thunderbird/52.8.0


A function for jumping to a definition by clicking on an identifier was recently added to master.[1]

For mouse users like myself this invoking this is probably the second mouse common use of the mouse (after text selection) so I propose we add a default binding for it in the global map. So which one? All other editors/IDEs I am familiar with (Eclipse, IntelliJ, VS Code) has this bound to <C-mouse-1>. Not that Emacs has to follow this convention, but since it's a convenient choice this would be my preferred binding.

Because this is Emacs it as obviously already used (for 'mouse-buffer-menu'). The meta modifier mouse events are all used for secondary selection (very useful) and I vaguely recall that shift modified mouse events (S-mouse-..) are reserved for the user (in the same spirit as the C-c), also makes sense.[2]

<C-mouse-2> is bound to 'face-menu'. It's useful on occasions (mostly in enriched-mode I presume?) but since mouse-2 is typically bound to the mouse wheel button on modern mice it is very uncomfortable for something used regularly hence not a good choice I think.

My proposal:

<C-mouse-3> is bound to a mode-specific context menu ("major mode menu"). Because this same menu is also available by clicking mouse-1 on the mode name in the modeline (and it's also in the frame/application menu) I propose we move 'mouse-buffer-menu' to C-mouse-3 in the interest of freeing up C-mouse-1 for 'xref-find-definitions-at-mouse'.

<C-M-mouse-1> would be another, more conservative option because the all of the <C-M-mouse-..> appears to be unbound.

Wishful thinking would be to also have 'xref-pop-marker-stack' bound to some mouse event (ideally C-mouse-3) to enable keyboard-free code browsing when one so feel inclined, but I may be greedy here and would settle for keeping that one to my private keymap for now.

What do you think?

I am not subscribed to the list so I would be grateful if I would be CC:ed any replies.



Tobias Gerdin

[1]: http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=455a236d415d3ca9a25564cd3f295f5e5e0bb7b4 [2]: Even so, ffap.el binds the similar functionality 'ffap-at-mouse' to <S-mouse-3> through the command 'ffap-bindings'. So one option would be to introduce a "dwim-at-mouse" unifying xref-find-definitions-at-mouse and ffap-at-mouse and bind it to that.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]