Search code examples
emacscode-snippetsyasnippet

Emacs Yasnippet install


trying to install yasnippet for emacs 23 from https://github.com/joaotavora/yasnippet

Firstly I attempted the quick install but the yasnippet-bundle.el for the 'quick' install doesn't seem to be in the repository?

Secondly I attempted the full install.

When trying to do the full install I get the following error:

[yas] Check your `yas/snippet-dirs': ~/.emacs.d/snippets is not a directory

I have downloaded the latest bundle joaotavora-yasnippet-e53c41d/ and unpacked in into .emacs.d/plugins/

the addition to my `.emacs' is:

(add-to-list 'load-path
              "~/.emacs.d/plugins/joaotavora-yasnippet-e53c41d")
(require 'yasnippet) ;; not yasnippet-bundle
(yas/initialize)
(yas/load-directory "~/.emacs.d/plugins/joaotavora-yasnippet-e53c41d/snippets")

Basically, the install instructions seem to have become out of sync with the latest src. Does anyone know how to install it?


Solution

  • You need to initialize yas/root-directory. Here is how I setup yasnippet

    (require 'yasnippet "~/emacs/addons/yasnippet.el")
    (yas/initialize)
    (setq yas/root-directory "~/emacs/snippets")
    (yas/load-directory yas/root-directory)