tags:

views:

596

answers:

2

Hi,

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 ?

+3  A: 

Emacs, by default, only allows certain keys to be prefixes (the start of multi-key commands). See http://www.gnu.org/software/emacs/elisp/html_node/Prefix-Keys.html You need to create a keymap and bind it to C-p.

ysth
+13  A: 

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

Trey Jackson