unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Keybinding for finding definition by mouse
@ 2018-07-08 20:06 Tobias Gerdin
  2018-07-09 17:09 ` Eli Zaretskii
  2018-07-09 17:43 ` Yuri Khan
  0 siblings, 2 replies; 10+ messages in thread
From: Tobias Gerdin @ 2018-07-08 20:06 UTC (permalink / raw)
  To: emacs-devel

Hello,

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.

--

Regards,

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.




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

* Re: Keybinding for finding definition by mouse
  2018-07-08 20:06 Keybinding for finding definition by mouse Tobias Gerdin
@ 2018-07-09 17:09 ` Eli Zaretskii
  2018-07-09 20:40   ` Tobias Gerdin
  2018-07-09 21:17   ` Tobias Gerdin
  2018-07-09 17:43 ` Yuri Khan
  1 sibling, 2 replies; 10+ messages in thread
From: Eli Zaretskii @ 2018-07-09 17:09 UTC (permalink / raw)
  To: Tobias Gerdin; +Cc: emacs-devel

> From: Tobias Gerdin <tgerdin@gmail.com>
> Date: Sun, 8 Jul 2018 22:06:18 +0200
> 
> 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?

I wonder whether we should.  I think people who like to use the mouse
for xref-find-definitions will bind the command to something handy,
like C-mouse-1 (and give up on, or rebind, mouse-buffer-menu).  We
cannot do that by default, and OTOH binding it to something like
C-M-mouse-1 sounds too difficult to use (and then there's the problem
of binding xref-pop-marker-stack).

I'm also not convinced many people will want such a binding, as most
of us use the keyboard for these commands.

So I think we should leave this unbound by default, at least for now,
and rely on people who want this on a mouse click to make their local
changes.



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

* Re: Keybinding for finding definition by mouse
  2018-07-08 20:06 Keybinding for finding definition by mouse Tobias Gerdin
  2018-07-09 17:09 ` Eli Zaretskii
@ 2018-07-09 17:43 ` Yuri Khan
  2018-07-09 17:50   ` Marcin Borkowski
  1 sibling, 1 reply; 10+ messages in thread
From: Yuri Khan @ 2018-07-09 17:43 UTC (permalink / raw)
  To: tgerdin; +Cc: Emacs developers

On Mon, Jul 9, 2018 at 3:06 AM Tobias Gerdin <tgerdin@gmail.com> wrote:

> 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.

That looks good on <mouse-8>, also known as history back. Possibly
also <M-mouse-5> aka Alt+scroll down, for those people who for some
reason don’t have back/forward buttons.



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

* Re: Keybinding for finding definition by mouse
  2018-07-09 17:43 ` Yuri Khan
@ 2018-07-09 17:50   ` Marcin Borkowski
  2018-07-09 18:42     ` Yuri Khan
  0 siblings, 1 reply; 10+ messages in thread
From: Marcin Borkowski @ 2018-07-09 17:50 UTC (permalink / raw)
  To: Yuri Khan; +Cc: tgerdin, Emacs developers


On 2018-07-09, at 19:43, Yuri Khan <yurivkhan@gmail.com> wrote:

> On Mon, Jul 9, 2018 at 3:06 AM Tobias Gerdin <tgerdin@gmail.com> wrote:
>
>> 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.
>
> That looks good on <mouse-8>, also known as history back. Possibly
> also <M-mouse-5> aka Alt+scroll down, for those people who for some
> reason don’t have back/forward buttons.

Interesting choice.  Is that "history back" or "mouse-8" really a mouse
button?

-- 
Marcin Borkowski
http://mbork.pl



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

* Re: Keybinding for finding definition by mouse
  2018-07-09 17:50   ` Marcin Borkowski
@ 2018-07-09 18:42     ` Yuri Khan
  2018-07-09 19:16       ` Helmut Eller
  2018-07-09 19:58       ` Tobias Gerdin
  0 siblings, 2 replies; 10+ messages in thread
From: Yuri Khan @ 2018-07-09 18:42 UTC (permalink / raw)
  To: Marcin Borkowski; +Cc: tgerdin, Emacs developers

On Tue, Jul 10, 2018 at 12:50 AM Marcin Borkowski <mbork@mbork.pl> wrote:

> >> Wishful thinking would be to also have 'xref-pop-marker-stack' bound to
> >> some mouse event
> >
> > That looks good on <mouse-8>, also known as history back. Possibly
> > also <M-mouse-5> aka Alt+scroll down, for those people who for some
> > reason don’t have back/forward buttons.
>
> Interesting choice.  Is that "history back" or "mouse-8" really a mouse
> button?

Yes. A common mouse design has a left and right button (1 and 3
respectively; can be reversed for left-handed users), a scroll wheel
(button 2 when clicked; 4 and 5 when turned up and down; on some
models, it can also be tilted left and right for horizontal scrolling,
X11 calls this buttons 6 and 7), and one or two thumb buttons (one for
going back in browser history, another forward; these are numbered 8
and 9).

Popping mark in general, and going back from a “find definition”, are
sufficiently semantically close to a “browser back” to be bound to the
same button.



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

* Re: Keybinding for finding definition by mouse
  2018-07-09 18:42     ` Yuri Khan
@ 2018-07-09 19:16       ` Helmut Eller
  2018-07-09 19:58       ` Tobias Gerdin
  1 sibling, 0 replies; 10+ messages in thread
From: Helmut Eller @ 2018-07-09 19:16 UTC (permalink / raw)
  To: emacs-devel

On Tue, Jul 10 2018, Yuri Khan wrote:

> On Tue, Jul 10, 2018 at 12:50 AM Marcin Borkowski <mbork@mbork.pl> wrote:
>
>> Interesting choice.  Is that "history back" or "mouse-8" really a mouse
>> button?
>
> Yes. A common mouse design has a left and right button (1 and 3
> respectively; can be reversed for left-handed users), a scroll wheel
> (button 2 when clicked; 4 and 5 when turned up and down; on some
> models, it can also be tilted left and right for horizontal scrolling,
> X11 calls this buttons 6 and 7), and one or two thumb buttons (one for
> going back in browser history, another forward; these are numbered 8
> and 9).

Funny, I didn't even know that my mouse had buttons 6 and 7.  No
button-8 and button-9, though.  So, I could use button-7 for
xref-find-definitions-at-mouse and button-6 for xref-pop-marker-stack.
I kinda like that.

Helmut




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

* Re: Keybinding for finding definition by mouse
  2018-07-09 18:42     ` Yuri Khan
  2018-07-09 19:16       ` Helmut Eller
@ 2018-07-09 19:58       ` Tobias Gerdin
  1 sibling, 0 replies; 10+ messages in thread
From: Tobias Gerdin @ 2018-07-09 19:58 UTC (permalink / raw)
  To: Yuri Khan, Marcin Borkowski; +Cc: Emacs developers

Den 2018-07-09 kl. 20:42, skrev Yuri Khan:

> On Tue, Jul 10, 2018 at 12:50 AM Marcin Borkowski <mbork@mbork.pl> wrote:
>
>>>> Wishful thinking would be to also have 'xref-pop-marker-stack' bound to
>>>> some mouse event
>>> That looks good on <mouse-8>, also known as history back. Possibly
>>> also <M-mouse-5> aka Alt+scroll down, for those people who for some
>>> reason don’t have back/forward buttons.
>> Interesting choice.  Is that "history back" or "mouse-8" really a mouse
>> button?
> Yes. A common mouse design has a left and right button (1 and 3
> respectively; can be reversed for left-handed users), a scroll wheel
> (button 2 when clicked; 4 and 5 when turned up and down; on some
> models, it can also be tilted left and right for horizontal scrolling,
> X11 calls this buttons 6 and 7), and one or two thumb buttons (one for
> going back in browser history, another forward; these are numbered 8
> and 9).
>
> Popping mark in general, and going back from a “find definition”, are
> sufficiently semantically close to a “browser back” to be bound to the
> same button.
I like this choice. But on macOS my 5-button mouse (no tilt) the buttons 
on the left and right of the mouse are reported as mouse-4 and mouse-5, 
so perhaps this differs between X11 and macOS? (which could be accounted 
for of course)

-Tobias



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

* Re: Keybinding for finding definition by mouse
  2018-07-09 17:09 ` Eli Zaretskii
@ 2018-07-09 20:40   ` Tobias Gerdin
  2018-07-10 16:16     ` Eli Zaretskii
  2018-07-09 21:17   ` Tobias Gerdin
  1 sibling, 1 reply; 10+ messages in thread
From: Tobias Gerdin @ 2018-07-09 20:40 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

Den 2018-07-09 kl. 19:09, skrev Eli Zaretskii:

>> 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?
> I wonder whether we should.  I think people who like to use the mouse
> for xref-find-definitions will bind the command to something handy,
> like C-mouse-1 (and give up on, or rebind, mouse-buffer-menu).  We
> cannot do that by default, and OTOH binding it to something like
> C-M-mouse-1 sounds too difficult to use (and then there's the problem
> of binding xref-pop-marker-stack).
>
> I'm also not convinced many people will want such a binding, as most
> of us use the keyboard for these commands.
Could this not partly be because up until now Emacs didn't supply such 
commands? (although as of the CEDET merge there is actually 
'semantic-ia-fast-mouse-jump' but since Emacs went in the xref direction 
I suspect few make use of it).

And whether it is in one's interest to use the keyboard or the mouse for 
these kind of commands is still is an open question (among others, see 
[1]). My observation from co-workers seems to indicate that using the 
mouse for this kind of functionality is very common and I think having a 
default binding would improve its discoverability (although I am aware 
that this is hardly an area of focus in Emacs).
> So I think we should leave this unbound by default, at least for now,
> and rely on people who want this on a mouse click to make their local
> changes.
Unless any of the above makes you reconsider I will not argue against 
this. I have submitted a pull request for similar kind of functionality 
to CIDER ([2]) where we have decided to add a default binding along with 
it so I was hoping to harmonize these with Emacs' xref (which CIDER 
doesn't make use of at the moment), but CIDER being out-of-tree there is 
obviously more leeway.

-Tobias
[1]: https://news.ycombinator.com/item?id=14544571
[2]: https://github.com/clojure-emacs/cider/pull/2372




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

* Re: Keybinding for finding definition by mouse
  2018-07-09 17:09 ` Eli Zaretskii
  2018-07-09 20:40   ` Tobias Gerdin
@ 2018-07-09 21:17   ` Tobias Gerdin
  1 sibling, 0 replies; 10+ messages in thread
From: Tobias Gerdin @ 2018-07-09 21:17 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

Den 2018-07-09 kl. 19:09, skrev Eli Zaretskii:

> I wonder whether we should.  I think people who like to use the mouse
> for xref-find-definitions will bind the command to something handy,
> like C-mouse-1 (and give up on, or rebind, mouse-buffer-menu).  We
> cannot do that by default, and OTOH binding it to something like
> C-M-mouse-1 sounds too difficult to use (and then there's the problem
> of binding xref-pop-marker-stack).
Another option would be "C-S-mouse-1" (currently unbound) which is quite 
convenient since Control and Space keys are located next to each other 
on most keyboards. And C-S-mouse-3 and/or mouse-4 (the "Browes Back" 
button) for xref-pop-marker-stack.

-Tobias




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

* Re: Keybinding for finding definition by mouse
  2018-07-09 20:40   ` Tobias Gerdin
@ 2018-07-10 16:16     ` Eli Zaretskii
  0 siblings, 0 replies; 10+ messages in thread
From: Eli Zaretskii @ 2018-07-10 16:16 UTC (permalink / raw)
  To: Tobias Gerdin; +Cc: emacs-devel

> Cc: emacs-devel@gnu.org
> From: Tobias Gerdin <tgerdin@gmail.com>
> Date: Mon, 9 Jul 2018 22:40:33 +0200
> 
> > I'm also not convinced many people will want such a binding, as most
> > of us use the keyboard for these commands.
> Could this not partly be because up until now Emacs didn't supply such 
> commands? (although as of the CEDET merge there is actually 
> 'semantic-ia-fast-mouse-jump' but since Emacs went in the xref direction 
> I suspect few make use of it).
> 
> And whether it is in one's interest to use the keyboard or the mouse for 
> these kind of commands is still is an open question (among others, see 
> [1]). My observation from co-workers seems to indicate that using the 
> mouse for this kind of functionality is very common and I think having a 
> default binding would improve its discoverability (although I am aware 
> that this is hardly an area of focus in Emacs).
> > So I think we should leave this unbound by default, at least for now,
> > and rely on people who want this on a mouse click to make their local
> > changes.
> Unless any of the above makes you reconsider I will not argue against 
> this. I have submitted a pull request for similar kind of functionality 
> to CIDER ([2]) where we have decided to add a default binding along with 
> it so I was hoping to harmonize these with Emacs' xref (which CIDER 
> doesn't make use of at the moment), but CIDER being out-of-tree there is 
> obviously more leeway.

Thanks.  I'd prefer to let people use the new command with their
private bindings, before we make a default binding for it.  IME, these
matters are best discussed with some experience behind us, and we
don't yet have such an experience.  Binding a command to a mouse
gesture of one's liking is a simple matter, so I don't think we
inconvenience too much users who'd like to use this new feature.



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

end of thread, other threads:[~2018-07-10 16:16 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-08 20:06 Keybinding for finding definition by mouse Tobias Gerdin
2018-07-09 17:09 ` Eli Zaretskii
2018-07-09 20:40   ` Tobias Gerdin
2018-07-10 16:16     ` Eli Zaretskii
2018-07-09 21:17   ` Tobias Gerdin
2018-07-09 17:43 ` Yuri Khan
2018-07-09 17:50   ` Marcin Borkowski
2018-07-09 18:42     ` Yuri Khan
2018-07-09 19:16       ` Helmut Eller
2018-07-09 19:58       ` Tobias Gerdin

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).