Emacs C-. not working in terminal
I use GNU Emacs, usually like emacs -nw
which launches the terminal version (as opposed to the windowed GUI version).
I write school papers in LaTeX
so I use flyspell-mode
for spell-checking within emacs. This works fine in the GUI version, but in a terminal, I run into issues with the keystroke C-.
(Ctrl-.). In a tty, this does nothing, and in terminator
or gnome-terminal
, this simply inputs a ".".
What can I do to make it do what it does in the windowed version (show spelling suggestions for a misspelled word)?
EDIT: In case this matters, I am using Ubuntu 12.04 with Emacs 23.3.1 (which I believe is default from the 12.04 repo).
Solution 1:
It looks like the important part of this question was already answered in the comments, but to address the root cause in case you're curious, I think ctrl-. doesn't work in a terminal because of some limitations of terminal emulators. In a standard terminal, ctrl is defined to send the ASCII code of the key you press minus 64 (this is why ctrl-J (74) sends newline (10) and ctrl-I (73) sends tab (9), for example). Since the period's ASCII code is 46, subtracting 64 would give -18, which is invalid because it's negative and there are no negative ASCII codes and therefore nothing for emacs to receive and understand.
When you run emacs in windowed mode, the terminal emulator mechanism is bypassed and instead the more robust keyboard handling of X11 is used, which can handle more obscure keystrokes (rather than reducing each keystroke down to one ASCII character, the program receives the original key plus all applicable modifiers, separately). So it's probably impossible to make tty-based emacs handle ctrl-. unless you make custom modifications to your terminal emulator (and probably also emacs).