设置特定Emacs模式的自定义键盘绑定 [英] Set custom keybinding for specific Emacs mode
本文介绍了设置特定Emacs模式的自定义键盘绑定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
.emacs
中有这个代码: ; ;来自AucTeX的PDFLaTeX
(全局设置键(kbdCc Mp)
(lambda()
(interactive)
(shell-command(concatpdflatex文件名))))
我不想在全局设置。有没有像 local-set-key
的功能?
解决方案
在一个模式下绑定一个密钥,在定义密钥之前需要等待加载模式。可能需要这种模式,或使用 eval-after-load
(eval-after-load'latex
'(define-key LaTeX-mode-map [(tab)]'outline-cycle)))
不要忘记'
- eval-after-load
不是宏,所以需要它们。
Though I know how to set a global key-binding in Emacs, I find it hard to even Google out the code for a local (minor-mode specific) key-binding. For instance, I have this code in my .emacs
:
;; PDFLaTeX from AucTeX
(global-set-key (kbd "C-c M-p")
(lambda ()
(interactive)
(shell-command (concat "pdflatex " buffer-file-name))))
I don't want to set it globally. Is there a function like local-set-key
?
解决方案
To bind a key in a mode, you need to wait for the mode to be loaded before defining the key. One could require the mode, or use eval-after-load
(eval-after-load 'latex
'(define-key LaTeX-mode-map [(tab)] 'outline-cycle)))
Don't forget either '
—eval-after-load
is not a macro, so it needs them.
这篇关于设置特定Emacs模式的自定义键盘绑定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文