C-. doesn't work in the terminal when I bind it to a command in Emacs. I tried this procedure on gnome-terminal
and real terminal tty1. I start Emacs with the -nw
flag, then press C-h k (the command for describe-key
), then press C-.. Emacs only receives the .
, without the Ctrl
. How do I get this working in Emacs?
I'm binding keys with this process:
(define-key c-mode-base-map (kbd "C-.") 'semantic-ia-fast-jump)
or
(define-key c-mode-base-map [(control .)] 'semantic-ia-fast-jump)
Keys can be bound to commands either interactively or in your . emacs file. To interactively bind keys for all modes, type M-x global-set-key RET key cmd RET . To bind a key just in the current major mode, type M-x local-set-key RET key cmd RET .
In most applications Ctrl+c is copy and Ctrl+x is cut. In emacs Ctrl+x generally refer to global commands, while Ctrl+c refers to language specific commands.
In short, most terminal emulators are limited in the control characters they can produce (for the simple reason that the original terminals that they are emulating were likewise limited).
So your terminal is very likely not producing anything other than .
when you press C-.
(and if that's the case, that's basically your answer, unless there is some way to configure the terminal to do otherwise).
(Any time you think Emacs is not acting on some input when running in a terminal, you should attempt to verify that Emacs is actually receiving the input you think it is.)
If your terminal is producing something other than .
, then refer to the following Q&As for details on how to get Emacs to recognise the sequence:
If you can run an xterm instead then you are probably in luck, due to some xterm-specific enhancements. Take a look at the following:
Some other related Q&As:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With