evil-mode evil-lookup-func question

Michael Markert markert.michael at gmail.com
Sun Jan 6 18:00:01 CET 2013


On Sun, Jan 06 2013 (01:25), Daniel Friedman <Daniel.Friedman at oberlin.edu> wrote: 

> Hi everyone,
>
> I'm quite new to hacking elisp (and this mailing list), so please bear
> with me!
>

[23 lines snipped]
>
> There are two main things that I need help with:
> 1. Why am I getting this error, even when there is a word under the
>    point? How can I resolve this bug?

Here:

    (evil-define-motion evil-lookup ()
      "Look up the keyword at point.
    Calls `evil-lookup-func'."
      (funcall evil-lookup-func))

Evil calls `evil-lookup-func' without any argument.

Try

    (defun evil-py-lookup ()
        (py-documentation (word-at-point)))
    (setq evil-lookup-func evil-lookup-func)

> 2. How do I make this hook only apply to python-mode buffers? When I
>    hit "K" in any buffer, it calls this function. I'm sure there's a
>    simple solution, but like I said, I'm very new to elisp.

That's because `evil-lookup-func' is not buffer-local but global.
Put a 

    (make-variable-buffer-local 'evil-lookup-func)
    
into your evil setup code. Maybe that would be a good idea to do it by
default, I like your idea!

Michael
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
Url : https://lists.ourproject.org/pipermail/implementations-list/attachments/20130106/8dfa4bda/attachment.pgp 


More information about the implementations-list mailing list