Shift-Tab在Emacs中产生隐藏错误 [英] Shift-Tab produces cryptic error in Emacs

查看:102
本文介绍了Shift-Tab在Emacs中产生隐藏错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试学习 org-mode ,并注意到当我退出emacs时,我的文件整齐地折叠。当试图展开整个文件时,按 S-TAB ,我在迷你缓冲区中收到以下错误消息: M- [z是未定义。 Googling的错误没有帮助。任何想法,打嗝正在发生,我该如何解决它?

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?

我正在使用Mac OS X 10.6.4与Terminal.app,GNU Emacs 23.2.1。

I'm using Mac OS X 10.6.4 with Terminal.app, GNU Emacs 23.2.1.

编辑:我可以确认问题是Terminal.app。我不会收到使用Carbon Emacs的这个错误消息,或者在iTerm.app中使用Emacs。

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.

感谢Gilles耐心的走过我的解决方案。

Thanks to Gilles for patiently walking me through a solution.

推荐答案

终端和其中运行的程序之间的接口(这里是Emacs)只能发送字符而不是键。所以特殊的键或键组合经常会以 ESC 开头的键序列发送。例如,您的终端显然发送 ESC [Z for Shift + Tab

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.

通常,Emacs会将这些字符序列翻译成关键名称,但似乎开发人员错过了这个。您可以使用

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])))

对于Emacs <= 22,只需使用(define-key function-key-map\e [Z[backtab])。)

某些模式可能会为 S-tab 而不是 backtab 定义绑定。如果您有Emacs 23,(define-key function-key-map [S-tab] [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.

这篇关于Shift-Tab在Emacs中产生隐藏错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆