4

I am an Emacs newbie having some problems navigating around when using the terminal, but pressing the ESC key brings up a huge list of key options which gives me the option of paging down and possibly select the right one, but any key I press seems to do the wrong thing.

enter image description here

I have 2 questions

  1. How can I page down through the options?
  2. For the option such as M-( I can effect them simply by pressing the key after the dash eg (, but how can I effect those preceded with the C-, eg C-M-\? What does the C-M mean?

Because I am using Spacemacs I assume that Spacemacs cannot capture the SPC key as the terminal requires. Is the menu with this menu with C-M- and they M- the standard Emacs menu/keybinding?

PS. What is the proper name of the area the menu is displayed?

0

What you're looking at is the Emacs notation for describing keybindings. A key binding like C-x means "hold down control and press x", and M-x means "hold down meta and press x". Of course, modern keyboards don't actually have a meta key, so we use alt instead. Additionally, keybindings that use meta can also be activated with escape. Thus M-x can also be activated by first pressing escape, and then pressing x.

I don't use Spacemacs, so I've never seen this particular menu. It seems pretty straight forward though. It only comes up when you hit escape, and then don't go on to finish the sequence, so it's just just showing you what's available. You can activate the M-( option by just typing (, because you've already typed the "meta". Thus it seems reasonable that you would be able to activate C-M-\ by just typing C-\. You could also have typed it by holding down both control and alt, then pressing the \ key.

C-h is the key used for all help functions. On it's own it's another prefix key like escape, you press C-h and then some other key or key combination to activate various help functions. For example, C-h i brings up the Info system, which lets you view a large set of hypertext manuals about Emacs and related subjects. In this case, it's being used as a context-sensitive command to bring up help about the menu itself. Likely that help will include instructions for scrolling the menu, amongst other things.

  • I am still unable to get the paging though the options working, and I still can't work out which keys correspond to the C-M – vfclists May 9 '17 at 21:20
  • C-M means both control and alt. In this specific scenario, however, you have effectively already pressed alt, leaving just the control. Have you tried pressing C-h while this menu is open? – db48x May 9 '17 at 22:24
  • I also cannot get paging working... pretty sure C-h is Ctrl+h ... but emacs/spacemacs seems to be doing something else instead of paging/scrolling... – Quang Van Mar 23 '18 at 5:32
  • [-1] Doesn't answer the question as to how one does the paging after an ESC. – mihai Sep 17 at 7:37
1

I had this same problem and asked for help in Github.

https://github.com/syl20bnr/spacemacs/issues/10509#issuecomment-376314380

I was able to narrow the problem to my terminal software, I couldn't press C-h which usually is Ctrl-h

To see if you have the same problem, press SPC h d k and then press C-h (Ctrl-h) and see what pops up, it should describe C-h, if it doesn't, it means something is interfering with your ability to press C-h.

If C-h your works, to scroll/page it's simply C-h n.

0

Since this question was from a Spacemacs user, I assume it is using the which-key package. C-h n and C-h p for paging does work in this case for getting the next key entries and the previous ones, respectively.

The user is asking specifically how to page when the prefix key used is ESC. In this case C-h might do something else. In my case, for example,

C-M-h (translated from <escape> C-h) runs the command mark-defun

so there is no way to run C-h p and C-h n for paging.

The which-key readme does specify a method to change (or add?!) a prefix key besides or in place of C-h [1], specifically for the cases like the above (the ESC prefix).

Method 2: Bind your own keys

Essentially, all you need to do for a prefix like C-x is the following which will bind to the relevant command.

(define-key which-key-mode-map (kbd "C-x <f5>") which-key-C-h-dispatch)

This is completely equivalent to

(setq which-key-paging-prefixes '("C-x")) (setq which-key-paging-key> "<f5>")

where the latter are provided for convenience if you have a lot of prefixes.

Unfortunately, I could not make it work. It rebinds C-x in the global map making Emacs unusable.

I'll leave this here as a pseudo-answer for future me or for anyone who can figure it out and provide a better answer than the current ones.

[1] https://github.com/justbur/emacs-which-key#paging-options

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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