禁用前缀键绑定
在 emacs 的 shell 模式下,当前退出 shell 模式的键绑定 ('comint-interrupt-subjob
) 是 "\Cc \Cc"
,我想更改就像在普通的 Linux shell 中一样,将其发送到 "\Cc"
。我尝试过
(add-hook 'shell-mode-hook '(lambda ()
(local-set-key "\C-c" 'comint-interrupt-subjob)
))
但没有成功。也许我需要禁用分配给 "\Cc"
的前缀。我怎样才能做到这一点?
In shell mode on emacs, the current key binding for quitting the shell mode ('comint-interrupt-subjob
) is "\C-c \C-c"
, and I want to change it to "\C-c"
as in ordinary linux shell. I tried
(add-hook 'shell-mode-hook '(lambda ()
(local-set-key "\C-c" 'comint-interrupt-subjob)
))
But it did not work. Probably I need to disable the prefix assigned to "\C-c"
. How can I do that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
试试这个:
一般来说,当您定义按键时,您应该在特定的键盘映射中定义它们,而不是仅仅希望
local-set-key
执行您想要的操作。注意:我更喜欢使用
kbd
来描述键,您的"\Cc"
就可以正常工作。Try this:
In general, when you define keys you should define them in particular keymaps, as opposed to just hoping the
local-set-key
does what you want.Note: I prefer using
kbd
for describing keys, your"\C-c"
would work just fine.这将在没有本地设置密钥错误检查的情况下完成工作
This will do the work without the error checking of local-set-key