我刚刚安装开发::PerlySense http://search.cpan.org/dist/Devel-PerlySense 0.0180.
我已将以下内容放入我的 .emacs 文件中:
; PerlySense
(load "~/perly-sense")
(global-unset-key "\C-p")
(global-set-key (kbd "\C-p \C-d") 'perly-sense-smart-docs-at-point)
(global-set-key (kbd "\C-p \C-g") 'perly-sense-smart-go-to-at-point)
但是,现在每当我尝试在 emacs 中加载 Perl 文件时,在加载之前都会收到以下错误:
错误“按键序列 C-p m f 开始
使用非前缀键 C-p"
我该如何解决这个问题?我是 emacs 新手,因此非常感谢这方面的任何帮助。
Update:
The ysth提交的链接 http://www.gnu.org/software/emacs/elisp/html_node/Prefix-Keys.html建议执行以下操作:
(use-local-map (make-sparse-keymap))
=> nil
(local-set-key "\C-p" ctl-x-map)
=> nil
(key-binding "\C-p\C-f")
=> find-file
(key-binding "\C-p6")
=> nil
现在,我需要将其添加到我的 .emacs 文件中来创建键盘映射吗?
当我将上述代码添加到 .emacs 并启动 emacs 时,我得到的错误是:
无效变量=>
这里可能有什么问题?
你的问题的明确答案是这样的:
(define-prefix-command 'perly-sense-map)
(global-set-key (kbd "C-p") 'perly-sense-map)
(define-key perly-sense-map (kbd "C-d") 'perly-sense-smart-docs-at-point)
(define-key perly-sense-map (kbd "C-g") 'perly-sense-smart-go-to-at-point)
有关正在执行的操作的更多信息,请查看以下文档:
- define-prefix-command http://www.gnu.org/software/emacs/manual/html_node/elisp/Prefix-Keys.html
- keymaps http://www.gnu.org/software/emacs/elisp/html_node/Keymaps.html#Keymaps
- kbd http://www.gnu.org/software/emacs/manual/html_node/elisp/Key-Sequences.html#index-kbd-1380
In the original post, you mixed using kbd
and the older "\C-p" notation. You can read this large tutorial discussing keybindings http://www.nongnu.org/emacs-tiny-tools/keybindings/, which has tons of information (more than what you probably need). I find the kbd
usage to be the easiest, you just pass it the string that you'd see when you do help on a key (C-h k).
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)