Shift-Tab 在 Emacs 中产生神秘错误
我正在尝试学习 org-mode 并注意到当我退出 emacs 时我的文件被整齐地折叠起来。当按 S-TAB
尝试展开整个文件时,我在迷你缓冲区中收到以下错误消息:M-[ z is undefined
。谷歌搜索错误没有帮助。知道打嗝发生在哪里以及如何解决它吗?
我使用 Mac OS X 10.6.4 和 Terminal.app、GNU Emacs 23.2.1。
编辑:我现在可以确认问题出在 Terminal.app 上。我使用 Carbon Emacs 或在 iTerm.app 中使用 Emacs 时没有收到此错误消息。
感谢吉尔斯耐心地引导我找到解决方案。
I'm trying to learn org-mode
and noticed my files are folded neatly when I exit emacs. When pressing S-TAB
in an attempt to unfold the entire file, I get the following error message in the mini-buffer: M-[ z is undefined
. Googling the error wasn't helpful. Any idea where the hiccup is occurring and how I might fix it?
I'm using Mac OS X 10.6.4 with Terminal.app, GNU Emacs 23.2.1.
Edit: I can confirm now that the problem is Terminal.app. I do not receive this error message using Carbon Emacs or when using Emacs from within iTerm.app.
Thanks to Gilles for patiently walking me through a solution.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
终端和在其中运行的程序(此处为 Emacs)之间的接口只能发送字符,而不能发送按键。因此,特殊按键或按键组合通常会发送以
ESC
开头的按键序列。例如,您的终端显然会发送ESC [ Z
表示 Shift+Tab。通常 Emacs 会将这些字符序列翻译回按键名称,但开发人员似乎错过了这一点。您可以自己定义它
(对于 Emacs <= 22,只需使用
(define-key function-key-map "\e[Z" [backtab])
。)某些模式可能会定义绑定
S-tab
而不是backtab
。如果您使用的是 Emacs 23,(define-key function-key-map [S-tab] [backtab])
应该可以使这些模式正常工作。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 sendsESC [ 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
(For Emacs <= 22, just use
(define-key function-key-map "\e[Z" [backtab])
.)Some modes may define bindings for
S-tab
and notbacktab
. If you have Emacs 23,(define-key function-key-map [S-tab] [backtab])
should make these modes work.与原始海报一样,我使用的是 Mac OS X,但版本为 10.6.8 和 GNU Emacs 23.4.1。我在使用 S-Tab 和 org-mode 时遇到了同样的问题。我能够通过以下非常有帮助的步骤解决此问题: http://stuff.mit.edu/afs/sipb/user/daveg/Info/backtab-howto.txt
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