1

On a Mac, using Emacs 26.1, I'd like to bind my windmove functions using:

(global-set-key (kbd "C-x C-<left>")  'windmove-left)
(global-set-key (kbd "C-x C-<right>") 'windmove-right)
(global-set-key (kbd "C-x C-<up>")    'windmove-up)
(global-set-key (kbd "C-x C-<down>")  'windmove-down)

"C-x C-<up>" and "C-x C-<down>" work, but for some reason the left and right ones don't. When I use describe-key on them, it seems I can't even enter those key sequences (i.e. it stops echoing after "C-x", and does not respond to the rest of the input). I also tried the syntax "C-x <C-left>", to no avail.

  • 1
    Sounds like Emacs is not seeing those keys at all. Check your window manager or OS, to see if it intercepts them for something else. And the best syntax to use with kbd is the one you see when you use C-h k. When I try that for such keys I see C-x <C-left>, C-x <C-up>, etc. – Drew Jul 23 at 14:16
  • That's exactly it @Drew, thanks! superuser.com/a/638725/195605 is the answer. If you want to push your comment into an answer, I will set it as the one. – cjauvin Jul 23 at 15:26
  • I'm sorry I wasn't clear: the problem in my particular case was the fact the Mac Mission Control app was preempting the Ctrl + left|right keys; once I disabled it, the keys began available to Emacs. Both kbd syntaxes seem to work equally fine. – cjauvin Jul 23 at 18:59
1

Sounds like Emacs is not seeing those keys at all. Check your window manager or OS, to see if it intercepts them for something else.

And the best syntax to use with kbd is the one you see when you use C-h k. When I try that for such keys I see C-x <C-left>, C-x <C-up>, etc. (But your question says that you already tried C-x <C-left>, so I guess that's not the problem.)

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.