1

I setup python support for emacs using rope and yasnippet by following the tutorial given at http://www.enigmacurry.com/2009/01/21/autocompleteel-python-code-completion-in-emacs/#disqus_thread. I declared a string variable a_str="Hello". Now when i type a_str. and press tab, i get the following message in the minibuffer

Symbol's function definition is void: yas/snippet-table

I was getting a drop-down earlier but suddenly this has stopped working. Any reason why this could be happening ?

Also,i would like to know the meaning of the line

(setq yas/trigger-key (kbd "C-c <kp-multiply>"))

Please Help Thank You

Kris
  • 1,403
  • 3
  • 17
  • 26

1 Answers1

3
(setq yas/trigger-key (kbd "C-c <kp-multiply>"))

means: generate the internal representation for the key binding described by the string C-c <kp-multiply>, and assign that value to the variable yas/trigger-key.

(<kp-multiply> would generally be the * key on the keypad.)

You could then subsequently use yas/trigger-key in key-bindings. e.g.:

(local-set-key yas/trigger-key 'some-function)

As for your main error, either something is not being loaded correctly (such that yas/snippet-table does exist in code, but isn't being loaded before it's used), or else there is an incompatibility between Yasnippet and another library which is trying to use it (presumably autocomplete in this case).

I see at the bottom of the comments thread you linked to that there was discussion at the time about a similar error being caused by changes in autocomplete 0.2 over 0.1. I also see that the tutorial author links to his git repository for his own Emacs config, and is still using version 0.1 of autocomplete there.

So I'd suggest checking your versions of each library first. The tutorial uses:

  • pymacs 0.23
  • yasnippet 0.5.9
  • autocomplete 0.1

The Rope version is unclear, and described only as "the very latest development version (as of December '08)"

Alternatively, you might prefer to grab the versions directly from that git repository (especially as the version of yasnippet in the repo says that it's version 0.2.2, not 0.5.9).

If you get it working with those, you could then try upgrading things (and perhaps adding a comment to that thread listing a set of compatible versions, if you come up with a working combination which is more recent).

Failing that, here's another git repository which might be useful:

https://github.com/gabrielelanaro/emacs-for-python/

phils
  • 71,335
  • 11
  • 153
  • 198
  • But if i do Ctrl-C *, i get the message "C-c * is undefined" – Kris Apr 08 '12 at 02:40
  • Note that the code you asked about doesn't bind `C-c ` to a function; it just sets the value of a variable. (One would expect that Yasnippet will use that variable to create a binding at some point, but I'd have to look at the code to find out if and where/when that happens.) – phils Apr 08 '12 at 03:00
  • Thanks for the reply. I managed to get rid of the `Symbol's function definition is void error by using yasnippet-0.5.9`. I was using the latest version 0.6.1 which i guess was causing that problem. But i think the tab key is now being used by autocomplete so im unable to use it to insert a snippet using yasnippet.Is there a way to use a different key combination to insert snippets ? – Kris Apr 08 '12 at 03:04
  • I'm not running such a set-up myself, so I'm unsure of the particulars. Maybe someone else can answer that. My best guess from what I saw was that this was the purpose of the `yas/trigger-key` variable, and the value of that was intended to be the key for inserting snippets manually (and that it was being set to something other than `TAB` to avoid conflicting with autocomplete). – phils Apr 08 '12 at 03:12
  • Finally got both rope and yasnippet working by using `(setq yas/trigger-key (kbd "C-c "))` and restarting emacs. – Kris Apr 08 '12 at 14:40