本文介绍了为什么emacs会将PageDown(< next>)键与M- [?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我在标准emacs-nox和emacs-gtk中发现了很大的区别。 我知道emacs控制台版本(emacs-nox)有一些键(例如Shift-Tab - )有问题,但不是与PageDown。 当我有空的.emacs文件,并尝试识别由PageDown键(通过Ch c)运行的命令名称,emacs-nox emacs-gtk正常工作 - 推动PageDown使得向上滚动,Ch c PageDown在minibuffer中打印滚动。 / p> 当我尝试绑定M- [键时出现问题。 在.emacs中,我只有一个语句: (global-set-key(kbdM- [ )'hippie-expand) emacs-nox不能识别按键运行的命令名称 - nt打印在minibuffer任何东西当Ch c PageDown时,将wriets缓冲〜6。 当我尝试 Ch k PageDown 我得到: M- [运行命令hippie-expand emacs-gtk正常工作 - 推动PageDown使滚动,Ch c PageDown在minibuffer中打印滚动。 所以我猜Emacs nox将PageDown作为M 任何想法如何解决这个问题在emacs-nox? 我使用emacs v23.2 编辑: 我测试了其他情况: emacs我只有:(全局设置密钥(kbd)'hippie-expand)和Ch c PageDown和Ch k PageDown正常工作(打印hippie-expand)缓冲区I push PageDown也很好。解决方案问题与终端发送到Emacs的转义序列有关。您可以在终端窗口中键入来检查转义序列,然后按键组合。所以,例如,如果你键入 你应该在终端窗口看到这样的东西: ^ [[ pre> 如果您键入 你应该看到 ^ [[6〜 这解释了问题:由是由下页。因此,当您将该前缀绑定到一个函数(例如,通过将全局设置为'ippie-expand ),您将获得以下效果当: 前两个字符( ^ [[ kbd> PageDown 的转义序列被解释为前缀,因此'hippie-expand 被调用。那么剩下的两个字符就是普通键盘的解释器,因此被插入缓冲区。这就是为什么当您按时,您会看到6〜。 我认为改变这一点的唯一方法是说服终端发送这些键的不同序列。但是更无痛的方法就是使用与。 (我会建议。) I found big distinction in standard emacs-nox and emacs-gtk.I know that emacs console version (emacs-nox) has problem with some keys (eg Shift-Tab - ), but not with PageDown.When I have empty .emacs file, and try to recognize command name run by PageDown key (by C-h c), emacs-nox emacs-gtk works normally - pushing PageDown makes scroll-up, and C-h c PageDown print scroll-up in minibuffer.The problem arise when i try to bind "M-[" key.In .emacs i has only one statement: (global-set-key (kbd "M-[") 'hippie-expand)emacs-nox does not recognize command name run by key - it does'nt print in minibuffer anything when C-h c PageDown, insted wriets to buffer "~6".When I try C-h k PageDownI get: M-[ runs the command hippie-expandemacs-gtk works normally - pushing PageDown makes scroll-up, and C-h c PageDown print scroll-up in minibuffer.So I guess emacs nox treats PageDown as M-[ and add something extra.Any idea how to fix this in emacs-nox?I use emacs v23.2EDIT:I tested other case: In .emacs I have only: (global-set-key (kbd "") 'hippie-expand)and both C-h c PageDown and C-h k PageDown works properly (prints hippie-expand), and when in buffer I push PageDown also works good. 解决方案 The problem has to do with the escape sequence the terminal sends to Emacs. You can check the escape sequence by typing in a terminal window, followed by the key combination. So, for instance, if you typeyou should see something like this in the terminal window:^[[If you typeyou should see^[[6~And that explains the problem: the key sequence generated by is a prefix of the key sequence generated by . Thus when you bind that prefix to a function (e.g., by globally setting to 'hippie-expand), you get the following effect when hitting :The first two characters (^[[) of 's escape sequence are interpreted as the prefix and thus 'hippie-expand is called. Then the remaining two characters are interpreters like ordinary key strokes, and are thus inserted into the buffer. That's why you see "6~" when you press .I think the only way to change this is to convince the terminal to send different sequences for those keys. But the more painless way is just to use a different shortcut than . (I would suggest .) 这篇关于为什么emacs会将PageDown(< next>)键与M- [?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-26 16:05
查看更多