Shift-Tab produces cryptic error in Emacs

ⅰ亾dé卋堺 提交于 2019-12-01 04:13:54

The interface between the terminal and the program running inside it (here, Emacs) can only send characters, not keys. So special keys or key combinations often send a key sequence beginning with ESC. For example, your terminal apparently sends ESC [ Z for Shift+Tab.

Normally Emacs translates these character sequences back into key names, but it seems that the developers missed this one. You can define it yourself with

(add-hook 'term-setup-hook
          (lambda () (define-key input-decode-map "\e[Z" [backtab])))

(For Emacs <= 22, just use (define-key function-key-map "\e[Z" [backtab]).)

Some modes may define bindings for S-tab and not backtab. If you have Emacs 23, (define-key function-key-map [S-tab] [backtab]) should make these modes work.

Like the original poster, I'm using Mac OS X, but version 10.6.8 and GNU Emacs 23.4.1. I was experiencing the same issues with S-Tab and org-mode. I was able to resolve this by following the steps that were extremely helpful at: http://stuff.mit.edu/afs/sipb/user/daveg/Info/backtab-howto.txt

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!