I want to bind a command to C-', C-` and C-0 through C-9 keys. It's not working in the terminal

Is there a way to do so?

  • What did you try that didn’t work?
    – Dan
    Commented Sep 23, 2018 at 10:26
  • I'm using (bind-key* "C-9" 'next-line) from use-package
    – zcaudate
    Commented Sep 23, 2018 at 10:53
  • If you're running emacs in text mode inside a terminal, that is not likely to be possible, I think. In general, try typing C-h c followed by the key you wish to bind to. If the key works at all, you'll see its name and whatever it is bound to in the echo area. Commented Sep 23, 2018 at 10:54
  • A valid answer to your question is "yes", so you might want to rephrase it to clarify what you're after.
    – Stefan
    Commented Sep 23, 2018 at 20:34
  • @Stefan. got it
    – zcaudate
    Commented Sep 24, 2018 at 0:37

1 Answer 1


The following works for me:

(define-key text-mode-map (kbd "C-9") #'next-line)

Or, with bind-key:

(bind-key (kbd "C-9") #'next-line)
  • I'm hoping to use it with bind-key
    – zcaudate
    Commented Sep 23, 2018 at 10:53
  • @zcaudate Then you should have said so initially. (Sorry I can't help; I am unfamiliar with that command.) Commented Sep 23, 2018 at 10:58
  • @HaraldHanche-Olsen I think it has to do with the fact that it's running inside the terminal. M-1 works but not C-1. Is there a reason for this?
    – zcaudate
    Commented Sep 23, 2018 at 11:47
  • 1
    @zcaudate This is the correct answer to the question you asked, but it sounds like your actual question is emacs.stackexchange.com/questions/1020/…
    – npostavs
    Commented Sep 23, 2018 at 12:08
  • 1
    @zcaudate Yes, there is a reason, but it's kind of technical: Briefly, terminal emulators will transmit M-1 as an ESCape character followed by 1 (and similarly for other M-something combinations). But characters like C-f are transmitted like the letter f with the high order bits zeroed, which works fine for control-letter combinations. There isn't a similar convention for other characters combined with the control key, though, so they generally flat out don't work in a terminal. Commented Sep 23, 2018 at 13:53

Your Answer

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

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