On Sun, Jan 06 2013 (01:25), Daniel Friedman <[email protected]> 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