[英]Assign a keymap to a derived mode in emacs
How can I assign a keymap to a derived mode in emacs (I am using the define-derived-mode
function). 如何在emacs中将键映射指定给派生模式(我使用的是
define-derived-mode
函数)。 There is a derived-mode-set-keymap
function but without examples or good documentation. 有一个
derived-mode-set-keymap
函数,但没有示例或良好的文档。
define-derived-mode
itself creates a keymap with the name MODE-map, where MODE is the name of the keymap you've just defined. define-derived-mode
本身创建一个名为MODE-map的键映射,其中MODE是您刚刚定义的键映射的名称。 I'm not sure what derive-mode-set-keymap
does that is not already done with define-derived-mode
; 我不确定什么是
derive-mode-set-keymap
,但是还没derive-mode-set-keymap
define-derived-mode
; looking at the source, they do similar things, and I'm unsure of the very low-level differences between the two (eg 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?). 看看源代码,他们做了类似的事情,我不确定两者之间的低级别差异(例如,
define-derived-mode
将父模式的键映射作为新键映射的父级,而`derive-mode -set-keymap还合并了键映射;两者之间的功能区别是什么?)。
If you do the following: 如果您执行以下操作:
(define-derived-mode foobar-mode text-mode "foo")
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. 然后,您可以根据需要开始操作其中任何一个。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.