将键盘映射分配给 emacs 中的派生模式
如何将键盘映射分配给 emacs 中的派生模式(我正在使用 define-衍生模式
函数)。有一个派生模式设置键映射函数,但没有示例或良好的文档。
How can I assign a keymap to a derived mode in emacs (I am using the define-derived-mode
function). There is a derived-mode-set-keymap
function but without examples or good documentation.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
define-driven-mode
本身会创建一个名为 MODE-map 的键盘映射,其中 MODE 是您刚刚定义的键盘映射的名称。我不确定 derive-mode-set-keymap 的用途是define-driven-mode
尚未完成的;查看源代码,它们做了类似的事情,并且我不确定两者之间的非常低级别的差异(例如define-driven-mode
将父模式的键盘映射作为新的键盘映射,而“derive-mode-set-keymap”也合并了键盘映射;两者之间的功能区别是什么?)。如果执行以下操作:
那么将定义以下变量:
foobar-mode-abbrev-table
foobar-mode-hook
foobar-mode-map
code>foobar-mode-syntax-table
然后您可以开始根据需要操作其中任何一个。
define-derived-mode
itself creates a keymap with the name MODE-map, where MODE is the name of the keymap you've just defined. I'm not sure whatderive-mode-set-keymap
does that is not already done withdefine-derived-mode
; looking at the source, they do similar things, and I'm unsure of the very low-level differences between the two (e.g.define-derived-mode
leaves the parent-mode's keymap as the parent of the new keymap while `derive-mode-set-keymap also merges the keymaps; what's the functional difference between the two?).If you do the following:
Then the following variables will be defined:
foobar-mode-abbrev-table
foobar-mode-hook
foobar-mode-map
foobar-mode-syntax-table
You can then start manipulating any of these as you like.