3

I'm beginning to learn about the magit package for Emacs. The integration is nice. But I'm very confused about how to get help with it.

I created a temporary repository, added a file test.org to it and ran the command magit-status. Then I hit ? to get help. I figured that this means it displays the command available to me inside the magit-status screen. The screen looks like the following:

screenshot

At the bottom are the magit actions available. Notice how it says s: Show Status. But s doesn't do that. It stages a file. And there is no u key, but it unstages a file.

Am I misreading this or am I invoking the wrong help screen or something else?

  • Is your caps lock depressed by chance -- capital `S` is *Stage All*? See line 1622: https://github.com/magit/magit/blob/master/magit.el – lawlist Feb 10 '15 at 16:36
  • No, I checked that. Not caps lock. –  Feb 10 '15 at 16:41
  • Its possible then, perhaps, that the `magit-status-mode-map` is active during the help screen -- which pressing the lower-case letter `s` would trigger `magit-stage-item` at line 1644 in the above-linked source code. If that is the case, it sounds like a bug . . . The library is very popular and another forum participant will likely have the answer shortly. Changing line 1644 from a lower-case `s` to an upper-case `S` would probably fix the problem, and then re-byte-compiling and restarting Emacs. – lawlist Feb 10 '15 at 16:45
  • I was slightly mistaken. I pressed `?` instead of `h`. The `?` key is bound to `magit-key-mode-popup-dispatch` and the `h` is bound to `magit-key-mode-popup-diff-options`. I'm not sure if it makes a difference, but even in the `h` key help screen there is no "stage" and "unstage" described. –  Feb 10 '15 at 16:50
  • 1
    I'm not sure why this happens, but it seems like hitting `s` while this help screen is open _does_ run the "view status" command (i.e. `magit-status`), not the "stage" command. – legoscia Feb 10 '15 at 17:16

1 Answers1

2

magit offers a form of context menus which fits with a keyboard-based input. Hence the key-binding depend on which menu you are in. Somewhat counter-intuitively, ? does not open the mode specific help (use C-h m for that, as usual). ? opens up the top level context menu, by invoking magit-key-mode-popup-dispatch. When in this menu, the available keybindings are different from those on invoking magit-status. In the status mode, s and u are bound to magit-stage-item and magit-unstage-item. Since they act on the item at point, it doesn't make sense to bind a key to them when in one of the context menus. Given this consideration, binding s to "Show Status" in the context menu launched by ? is quite natural.

tripleee
  • 175,061
  • 34
  • 275
  • 318
Pradhan
  • 16,391
  • 3
  • 44
  • 59