如何从 Emacs 中的次要模式键映射中删除键? [英] How to remove a key from a minor-mode keymap in Emacs?
问题描述
我已将 C-c/
全局分配给 ace-jump-mode 但 reftex-mode(与 AucTeX 一起使用的引文的次要模式)用一些我从未使用过的功能覆盖了此键.
I have globally assigned C-c/
to ace-jump-mode but reftex-mode (a minor mode for citations used with AucTeX) overrides this key with some function I never use.
我尝试了 local-unset-key
但它只从当前 major 模式的地图中解除绑定键.
I tried local-unset-key
but it only unbinds keys from the current major mode's map.
如何在不更改 reftex.el 的情况下从 reftex-mode-map
中删除 C-c/
?
How do I remove C-c/
from reftex-mode-map
without making changes to reftex.el?
推荐答案
您可以使用 define-key
更改现有的键映射.通过将 nil
作为要调用的函数传递,键将变得未绑定.我想你应该能够做这样的事情:
You can change an existing key map using define-key
. By passing nil
as the function to call, the key will become unbound. I guess that you should be able to do something like:
(define-key reftex-mode-map "C-c/" nil)
当然,你应该在某种钩子中做到这一点,例如:
Of course, you should do this in some kind of hook, for example:
(defun my-reftex-hook ()
(define-key reftex-mode-map "C-c/" nil))
(add-hook 'reftex-mode-hook 'my-reftex-hook)
这篇关于如何从 Emacs 中的次要模式键映射中删除键?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!