问题:
如何为次要模式创建自定义按键绑定?类似于这样。
以下是我目前的代码。我正在尝试让一个自定义按键绑定起作用:
(define-minor-mode num-mode
"Toggle the Num pad keys.
With no argument, this command toggles the mode.
Non-null prefix argument turns on the mode.
Null prefix argument turns off the mode.
When Num mode is enabled, the num pad inserts the
keys you see on the pad. This may over ried existing
definitions, and is probably only usefule if you aref
running Emacs through a terminal."
;; The initial value.
nil
;; The indicator for the mode line.
" NumPad"
;; The minor mode bindings.
;; This doesn't work right now!!!!
'(((kbd "<kp-1>") . "a"))
:global 1
)
调用自定义小模式"num-mode"并在 mini buffer 中验证其打开后,当我在数字键盘上按下 "1" 键时,我收到错误信息 "
<kp-1>
未定义"。我想要的是在按下 "<kp-1>
" 键时,将 a
打印出来。 (仅作测试)背景:通常我使用数字键盘在不同的缓存区之间移动(箭头键让我朝着相应的方向移动)。这是全局设置。我想创建一个可以在需要时使用数字键盘简单输入数字的小模式。
默认情况下,我的数字键盘上的键没有定义。我使用
<kp-0>
到 <kp-9>
来为数字键定义按键绑定。我可以创建一个可以调用的小模式,但我无法绑定任何按键。这对所有按键绑定都适用,包括未在其他地方定义的按键绑定。
感谢任何帮助!