In M-x term, how can I make C-x do what it does in line mode in char mode also? I know that C-c is one answer here but (a) that's not good enough for me and (b) I'm using emacs so there has to be a way. I don't ever use C-x in a terminal so that's not an issue.

Is there a key map for char mode terminal that I can modify to get what I want? I know there is a command to list key maps somewhere but I can't figure that out either.

2 Answers 2


It is possible to re assign C-x as an escape character:

(add-hook 'term-mode-hook
   (lambda ()
     ;; C-x is the prefix command, rather than C-c
     (term-set-escape-char ?\C-x)
     (define-key term-raw-map "\M-y" 'yank-pop)
     (define-key term-raw-map "\M-w" 'kill-ring-save)))

from SO - How to switch to a different buffer from a terminal buffer


I have this hack in my init files to set both C-c and C-x as escape characters. Normally, you can only have one.

(add-hook 'term-mode-hook (lambda ()
                            ;; Hack to set two escape chars.
                            (let (term-escape-char)
                              (term-set-escape-char ?\C-x))
                            (let (term-escape-char)
                              (term-set-escape-char ?\C-c))))

This idea is taken from the code for ansi-term in term.el.

You can also just use ansi-term instead of term to start a terminal instead of using the above hack.

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.