如何使C-p成为Devel :: PerlySense的Emacs前缀关键字? [英] How can I make C-p an Emacs prefix key for Devel::PerlySense?

查看:222
本文介绍了如何使C-p成为Devel :: PerlySense的Emacs前缀关键字?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚安装了 Devel :: PerlySense 0.0180。



我把我的.emacs文件放在以下文件中:

  PerlySense 
(加载〜/ perly-sense)

(全局未设置密钥\Cp)

(全局设置密钥kbd\Cp \Cd)'perly-sense-smart-docs-at-point)

(全局设置密钥(kbd\Cp \Cg)'perly -sense-smart-go-to-at-at-point)

但是,现在每当我尝试加载一个Perl文件在emacs,我得到以下错误之前,它加载:


错误键序列Cp mf启动
与非前缀键Cp


我该如何解决?我很喜欢emacs,所以真的很感谢在这方面的任何帮助。



更新:



由ysth提交的链接建议,执行以下操作:

 (use-local-map(make-sparse-keymap))
=> nil
(local-set-key\C-pctl-x-map)
=> nil
(键绑定\C-p \C-f)
=> find-file

(键绑定\C-p6)
=> nil

现在,我需要将其添加到我的.emacs文件中以创建键盘映射吗? p>

当我将上述代码添加到.emacs并启动emacs时,我得到的错误是:



void -variable =>



这里有什么问题?

解决方案

你的问题的明确答案是:

 (define-prefix-command'perly-sense-map )
(全局设置密钥(kbdCp)'perly-sense-map)
(定义键perly-sense-map(kbdCd)'perly-sense-smart- docs-at-point)
(定义键perly-sense-map(kbdCg)'perly-sense-smart-go-to-at-at-at-point)

有关所做的更多信息,请查看





在原始帖子中, code> kbd 和较旧的\Cp符号。您可以阅读这个讨论键盘的大型教程,它有大量的信息(超过你可能需要的)。我发现 kbd 的用法是最简单的,你只需传递一个字符串,当你对一个键进行帮助时,你会看到( Ch k )。


I just installed Devel::PerlySense 0.0180.

I have put the following in my .emacs file:

 ; 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)

But, now whenever I try to load a Perl file in emacs, I get the following error prior to it getting loaded:

error "Key sequence C-p m f starts with non-prefix key C-p"

How can I fixed this? I'm new to emacs, so would really appreciate any help in this regard.

Update:

The link submitted by ysth suggests, doing the following :

 (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

Now, do i need to add this to my .emacs file to create the keymap?

When i add the above code to .emacs and start emacs the error i get is :

void-variable =>

What can be the problem here ?

解决方案

The explicit answer to your question is this:

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

For more information as to what's being done, check out documentation for

In the original post, you mixed using kbd and the older "\C-p" notation. You can read this large tutorial discussing 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).

这篇关于如何使C-p成为Devel :: PerlySense的Emacs前缀关键字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆