0

I was just looking at the Ediff manual¹ for something, and it's one of those Emacs manuals that (a bit annoyingly) only list keybinds and not function names (so, if you have rebinding going on, you don't know what it's talking about without digging into source).

And the keys it suggests for the things I want to do aren't doing anything for me—I get X is undefined, and if I C-hkX, I get X is undefined—these keys Ediff says should be available aren’t otherwise bound to self-insert or anything else.

(I should note here this doesn’t mean that I have no Ediff bindings; the keys shown onscreen in the Ediff Control Panel window do all work. It’s just keys that the manual mentions I’m having trouble invoking.)

The weird things, though, are that

  1. searching my configs, I don't have anything named .*ediff.* rebound, so I don't know why those default keys wouldn't work, and
  2. since Ediff has its own control panel buffer with its own keymap that uses mostly unchorded commands, why is a key that the manual says should do something, like @ or *, unbound (not bound to self-insert)?

I can use the source (mostly ediff-util.el) to find what functions these keys are supposed to be bound to and then bind them or run them with M-x, but I’m not sure how to go about diagnosing why I don’t have these keys bound in the first place.

(In case it matters, I’m running Emacs in server mode with my emacsclient running in a TTY.)

To clarify why I haven’t accepted prior answers:

  1. I’m not asking how to find a particular key of Ediff — neither any particular key, nor any key of Ediff in particular. I’m asking how (if it’s possible at all, and from the Elisp manual’s explanation of keymaps, it feels like it should be) to find what the default map of any given mode or package might set, so that if the manual or someone online tells me to do something by typing some keys, and that doesn’t work, to find out what they were telling me to do in terms of Elisp commands.
  2. The crux of this is not that I want to know how to do certain functions of Ediff (or any other package), it’s that somehow my keymaps are obliterating default mappings entirely, and I don’t know how that’s happening. I’m looking for how to find the missing key mappings and how they became missing in the first place. I generally use use-package to create bindings and keychords, and I can’t see where any of them conflict.
  3. I’m not even sure how I’d go about removing another keybinding without replacing it with one of my own if I wanted to (using use-package bindings and not explicitly removing bindings or mapping them explicitly to self-insert), which is what I’m experiencing with Ediff—if someone can explain that, it would be a huge clue.

¹ Though I link to the current HTML version of the Ediff manual for convenience, the one I’m reading is the Info pages shipped with Emacs 25.2.2.
2
  • 2
    Have you tried starting Emacs with emacs -Q (no init file)? That should show you what the default bindings are. If X etc. is not bound in that case, and if the Ediff doc says it should be, consider reporting a bug: M-x report-emacs-bug. If you don't see the problem without your init file, bisect your init file to find the culprit.
    – Drew
    Oct 18, 2019 at 17:00
  • 1
    Which keys in a particular are you having issues with? From the Ediff Control Panel ? displays the keys. Some of the help may look odd, for example "X - read-only in buf X" here X refers to the ediff buffer names A or B.
    – alls0rts
    Oct 21, 2019 at 11:04

3 Answers 3

1

When you say X, are you referring to the help output such as X - read only in buffer X. There X is referring to the Ediff buffer names, for example A or B.

1
  • I put X in <kbd> tags to indicate that it was the key I was trying to type, not that it was a "foo" or "mumble".
    – Trey
    Nov 1, 2019 at 21:40
0

On X

  • open two files to compare in two separate windows
  • M-x ediff-buffers RET RET RET
  • now the cursor is in a new small ediff frame
  • C-h k w d Now I see a help window explaining that w d runs ediff-buffers and how it works.

Maybe you had the cursor in the main frame instead of the small ediff frame?

On terminal

Same as above, but instead of a new small frame I have a new small (one-line) ediff window. With the cursor on the new window, I can ask for help on w d.

Maybe you had the cursor in one of the two windows containing the files instead of the small ediff window?

7
  • Sorry, if I go to the section “3.1 Quick Help Commands” of my original link, I see a list of commands, for instance, “wd: Saves the output from the diff utility for further reference”. How do I discover what <kbd>M-x</kbd> command this <kbd>wd</kbd> refers to?
    – Trey
    Mar 19, 2021 at 19:55
  • Also, as I explained above, I used “X” to stand in for any given key or sequence like <kbd>wd</kbd> — both because X is a variable and because X is not an actual ediff command and I didn’t want an answer that just told me what, say, <kbd>wd</kbd> refers to without telling me how to find that out myself for all the keys.
    – Trey
    Mar 19, 2021 at 19:57
  • Sorry, you are right. I completely rewrote my answer Mar 20, 2021 at 0:43
  • No problem... but as my original question said, I’d apparently gobbled up some of the bindings with my own global bindings, so describe-key won’t help for me. (Unless I run it from within emacs -Q, but as I described above, that isn’t really an answer, either.)
    – Trey
    Mar 20, 2021 at 19:17
  • That would be very strange. In my example case, this means you have remapped <kbd>w</kbd>. Mar 20, 2021 at 22:34
0

The information of orignial keybindings of a package can, of course, be found in the source code. All of Emacs is open source so it is easy to have a look at it.

For example, you want to know which keys Emacs help-mode originally bound? Then keybindings of that mode is expected to be found in the variable help-mode-map. So you only need to go to the place, where help-mode-map is defined. (You get there by putting point over the string help-mode-map and run the command xref-find-definitions, which is bound to M-.) You could also search the source code of the feature for define-key.

With this you will very often find the information you seek, but of course, Emacs is not an entirely homogeneous system and there might be cases, where you have to understand more of its source code.

Another option, which does not involve looking at the source code, is running an Emacs instance without any customization. You can do that by starting Emacs with its command line option -Q, you might have to load Elpa packages by hand, though.

2
  • Your answer was already suggested as a comment. But I don’t understand how that helps me discover why or where my own customizations are interfering. It only tells me that whether a) yes, they are interfering, or b) the documentation is wrong. Which isn’t useless, but isn’t my question, either.
    – Trey
    Mar 22, 2021 at 16:36
  • @Trey run emacs -Q and test if those keybindings work without modifications. If yes, then bisect your init file. An Emacs config can get far to complex to tell whats wrong, without seeing the source code.
    – jue
    Mar 30, 2021 at 0:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.