将键盘映射分配给 emacs 中的派生模式

发布于 2024-08-20 17:21:42 字数 93 浏览 7 评论 0原文

如何将键盘映射分配给 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

初见你 2024-08-27 17:21:42

define-driven-mode 本身会创建一个名为 MODE-map 的键盘映射,其中 MODE 是您刚刚定义的键盘映射的名称。我不确定 derive-mode-set-keymap 的用途是 define-driven-mode 尚未完成的;查看源代码,它们做了类似的事情,并且我不确定两者之间的非常低级别的差异(例如 define-driven-mode 将父模式的键盘映射作为新的键盘映射,而“derive-mode-set-keymap”也合并了键盘映射;两者之间的功能区别是什么?)。

如果执行以下操作:

(define-derived-mode foobar-mode text-mode "foo")

那么将定义以下变量:

  • 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 what derive-mode-set-keymap does that is not already done with define-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:

(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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文