Emacs 如何重新定义 Shift-R 以实现预期用途
我检查了我的 elisp 文件,以确保我没有任何包含 Shift+R 的绑定(而且我还没有找到任何绑定)。我希望 SHIFT+R 打印大写字符,但在 Emacs 命令行中却得到 RR undefined 。这仅适用于 C/C++ 主要模式。
有什么建议吗?
更新:描述该键表明它是未定义的。我如何将其定义为正常的预期用途(大写字母 R)?
I've checked my elisp files to make sure that I do not have any bindings that contain Shift+R (and I have not found any). I expect SHIFT+R to print an uppercase character, but instead I get R R undefined inside of the Emacs command line. This is only in C/C++ major modes.
Any suggestions?
Update: Describing the key shows that it is undefined. How would I define it for the normal, expected use (capitalizing the letter R)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我认为“预期用途”是指插入“R”字符。为此,您需要将密钥绑定到“self-insert-command”:
或者,在您的 .emacs 或 .emacs.d/init.el 文件中:
当然,这应该是默认值......
I assume by the 'expected use' you mean to insert the 'R' character. For this, you'd need to bind the key to 'self-insert-command':
Or, in your .emacs or .emacs.d/init.el file:
Of course, this should be the default....
我在这里有点似曾相识,如果没记错的话,我几年前遇到的行为是(在 Windows 上)某些辅助功能设置未设置或更改了右 Shift 键的键码。抱歉,我不能更具体,但这也许会刺激其他人得出真正的答案。您可以进行一项测试:该行为是否适用于两个 Shift 键或仅一个?如果答案是只有一个显示不良行为,那么所有按键都会显示该不良行为吗?
I'm getting a little deja-vu here and if memory serves the behavior I encountered some years ago was that (on Windows) certain accessibility settings unset or changed the keycode for the right shift key. Sorry I cannot be more specific but maybe this will stimulate someone else to come up with the real answer. A test you can make: does the behavior work with both shift keys or just one? If the answer is just one shows the bad behavior, is that bad behavior shown with all keys?
尝试 Ch k(描述键),然后按 Shift-R。然后,describe-key 会告诉您该键绑定了什么。至少这会给您一个关于是否存在活动绑定的提示。如果存在绑定,也许它会提示您在启动文件中搜索其他内容。
Try C-h k (describe-key), then press Shift-R. describe-key will then tell you what is bound to that key. At least that will give you a hint as to whether or not there is an active binding. If there's a binding, perhaps it will give you a hint of something else to search for in your startup files.
听起来你和我遇到了同样的问题。当每个 R-* 命令都未定义时,在任何 html 缓冲区中键入 Re... 都会尝试执行 R- 命令。结果发现我的 .emacs 文件中有一个拼写错误。我将全局键映射设置为
(kbd "REF")
而不是(kbd "RET")
,修复它使问题立即消失。因此,我建议检查 .emacs 文件中是否有类似的内容。You sound like you're having the same problem I had. Typing Re... in any html buffer would try to execute an R- command, when every single R-* command was undefined. Turned out that I had a typo in my .emacs file. I had a global-key-map set to
(kbd "REF")
instead of(kbd "RET")
, and fixing it made the problem immediately vanish. So I'd recommend checking for anything similar in your .emacs file.