2013-05-29

ErgoEmacs Terminal Arrow Fix

Matthew L Fidler fixed a long-standing major bug in ErgoEmacs keybinding. See: https://code.google.com/p/ergoemacs/issues/detail?id=37

In terminal, when you press arrow keys, ErgoEmacs will insert gibberish. This is a semi-bug in emacs.

In emacs, put this in your init:

(global-set-key (kbd "M-O") 'forward-char)

nothing but just that line. Then, start emacs by emacs -nw. Then press any arrow key, you'll see that it insert gibberish.

This is related to escape sequence in terminal. Kinda have to do with terminal history. The arrow keys actually send escape sequences, and somehow, so does emacs's 【Meta+O】. (this is why emacs's Meta can also be pressed by Esc)

From user's perspective, this is clearly a emacs bug, but it might be such historical issue that it's hard to fix or can't be fixed. A related issue is that in emacs running in terminal, it can't distinguish between 【Ctrl+A】 and 【Ctrl+a】.