Cross-reference commits

19 views
Skip to first unread message

PJ Weisberg

unread,
Apr 19, 2011, 1:28:38 AM4/19/11
to ma...@googlegroups.com
A pull request I just sent in:
https://github.com/philjackson/magit/pull/171
a.k.a.
git://github.com/pjweisberg/magit.git link-commits
======================================================================
When a commit message mentions another commit by its SHA1 hash, put
the magit-log-sha1 face on it, and allow the user to visit the
referenced commit by putting the cursor on it and pressing RET. (I
also did the same thing for the two parents in a merge commit.)

It picks out only hashes that actually are other commits. So in the
phrase "Elvis is dead," "dead" would be highlighted if and only if
dead uniquely identifies a commit in the repository. In the phrase
"Zombies are deader than vampires," "dead" would never be highlighted
because of the non-hex digit in the word.

To make it easier to get back to where you were I added "back" and
"forward" buttons to the commit buffer.
======================================================================

Someone mentioned on this list that keybindings were a controversial
topic, so I thought I'd mention this here, because I bound those
"back" and "forward" functions I added to <M-left> and <M-right> in
the commit buffer. (Firefox and Chrome use those keys for back and
forward.) However, magit-mode already binds <M-left> to
magit-goto-parent-section. Does that seem like an acceptable change,
or should I pick a different binding?

-PJ

Óscar Fuentes

unread,
Apr 19, 2011, 2:08:43 AM4/19/11
to ma...@googlegroups.com
PJ Weisberg <pjwei...@gmail.com> writes:

[snip]

> Someone mentioned on this list that keybindings were a controversial
> topic, so I thought I'd mention this here, because I bound those
> "back" and "forward" functions I added to <M-left> and <M-right> in
> the commit buffer. (Firefox and Chrome use those keys for back and
> forward.) However, magit-mode already binds <M-left> to
> magit-goto-parent-section. Does that seem like an acceptable change,
> or should I pick a different binding?

<M-right> is forward-word, as usually. <M-left> is not bound to
backward-word on the commit buffer by accident, I guess.

Those bindings are very common on Emacs and I'm sure that there are
people that use them for moving the cursor around. I recommend using
different bindings.

PJ Weisberg

unread,
Apr 19, 2011, 2:28:49 AM4/19/11
to ma...@googlegroups.com
On Mon, Apr 18, 2011 at 11:08 PM, Óscar Fuentes <o...@wanadoo.es> wrote:
> PJ Weisberg <pjwei...@gmail.com> writes:
>
> [snip]
>
>> Someone mentioned on this list that keybindings were a controversial
>> topic, so I thought I'd mention this here, because I bound those
>> "back" and "forward" functions I added to <M-left> and <M-right> in
>> the commit buffer.  (Firefox and Chrome use those keys for back and
>> forward.)  However, magit-mode already binds <M-left> to
>> magit-goto-parent-section.  Does that seem like an acceptable change,
>> or should I pick a different binding?
>
> <M-right> is forward-word, as usually. <M-left> is not bound to
> backward-word on the commit buffer by accident, I guess.

The commit buffer, and all other Magit buffers.

> Those bindings are very common on Emacs and I'm sure that there are
> people that use them for moving the cursor around. I recommend using
> different bindings.

Which bindings would you suggest?

I was actually a little surprised to see Emacs binds M-(left/right) to
the same functions that C-(left/right) are bound to. If I had to
guess I would think that more people are used to using the C-
versions, since those also work outside of Emacs. That, and no one
seems to have had a problem with using <M-left> for
magit-goto-parent-section up til now. (It might actually make more
sense to have magit-goto-parent-section on an "up" key rather than a
"left" key, IMO.)

Moritz Bunkus

unread,
Apr 19, 2011, 3:06:25 AM4/19/11
to ma...@googlegroups.com
Hey,

On Tuesday 19 April 2011 08:28:49 PJ Weisberg wrote:

> Which bindings would you suggest?

help-mode uses C-c C-f and C-c C-b for forward/backward.

> I was actually a little surprised to see Emacs binds M-(left/right) to
> the same functions that C-(left/right) are bound to.

I have M-(left/right) and C-(left/right) do completely different
things (e.g. winner-mode stuff). My point is that everyone has different
needs, and re-binding common movement keys is pretty bad IMHO. Why not
use keys that do similar things in other modes? Helps human brains
remember them.

Regards,
Mosu

signature.asc

PJ Weisberg

unread,
Apr 19, 2011, 11:28:50 AM4/19/11
to Moritz Bunkus, ma...@googlegroups.com
On Tuesday, April 19, 2011, Moritz Bunkus <mor...@bunkus.org> wrote:
> things (e.g. winner-mode stuff). My point is that everyone has different
> needs, and re-binding common movement keys is pretty bad IMHO.

Ok, that's a good point.

> Why not
> use keys that do similar things in other modes? Helps human brains
> remember them.

That's basically the idea I had when I chose M-(left/right). Firefox,
Chrome, and I'm pretty sure IE use those keys for forward/back. I
absentmindedly typed Alt+left in Microsoft Visual Something-or-other
and it did what I wanted (switched to the last file I was viewing). I
figured if people were trying to find the key to go back, that would
be their first guess.

Well, if no one else thinks M-direction is the right choice I can
change to C-c C-(b/f) (and mention them somewhere in the
documentation, since those seem non-obvious to me). In any case I
should add those bindings for consistency with Help mode.

PJ Weisberg

unread,
Apr 19, 2011, 2:26:50 PM4/19/11
to Moritz Bunkus, ma...@googlegroups.com
On Tuesday, April 19, 2011, PJ Weisberg <pjwei...@gmail.com> wrote:
> On Tuesday, April 19, 2011, Moritz Bunkus <mor...@bunkus.org> wrote:
>> things (e.g. winner-mode stuff). My point is that everyone has different
>> needs, and re-binding common movement keys is pretty bad IMHO.
>
> Ok, that's a good point.

At least it seems so until I consider that Magit already rebinds one
of those two keys, and nobody's complained. I wonder if it's because
people who have their own bindings for M-(direction) also know how to
disable the mode-specific bindings they don't like.

--

-PJ

Reply all
Reply to author
Forward
0 new messages