1

I've just installed yasnippet, and added the following to my .emacs:

(add-to-list 'load-path
          "~/.emacs.d/plugins/yasnippet")
(require 'yasnippet)
(yas-global-mode 1)

However, on startup, I get the following error from Emacs:

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

Now, I've checked that variable, and it's defined as something called top-level-dirs in yasnippet.el. In my case, snippets is located in ~/.emacs.d/plugins/yasnippet, rather than directly in ~/.emacs.d/ as the program seems to expect. How do I correct this?

1

I don't have or use yasnippets. But it sounds like the error message is trying to tell you that the value of that variable should be an existing directory but is not.

Is that variable a user option? IOW, if you do C-h v yas-snippet-dirs does buffer *Help* have a link to customize the variable value? If so, follow that link and customize the value to ~/.emacs.d/plugins/yasnippet/ (or whatever the correct directory is).

If the variable is not a user option, try setting it in your init file anyway, using (setq yas-snippet-dirs "~/.emacs.d/plugins/yasnippet/").

  • My setup does not have the trailing forward-slash -- will that make a difference? I modified the source as follows: (defcustom yas-snippet-dirs (list "/Users/HOME/.0.data/.0.emacs/.0.snippets") . . . – lawlist Apr 5 '14 at 6:36
  • @lawlist: Again, I know nothing about yasnippets. Why modify the source code? Sorry, I don't follow. It sounds like the OP just needs to check whether the variable value is the name of an existing directory. If he needs to experiment with adding or removing /' from the end of the value, he can do that. Changing a defcustom` is rarely a good idea, if only because of load/eval order problems: you then need to ensure that your defcustom is eval'd first etc. – Drew Apr 5 '14 at 18:03
  • For a few of the libraries that I plan on using for years to come, I have taken over the source code entirely and made my own revisions. For those libraries that I have completely taken over (e.g., lawlist-org-mode, lawlist-calculator-mode, lawlist-calendar-mode, etc.), I have chosen to set the default values by modifying the defcustom settings. It's not something that I would suggest as a sample answer, but makes sense to me for my own setup. I wasn't sure whether using list is necessary when using yas-snippet-dirs, so I put that in my comment too just in case it might be important. – lawlist Apr 5 '14 at 18:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.