yas/load-snippet-dirs does nothing #253

ViktorQvarfordt opened this Issue Jun 5, 2012 · 8 comments


None yet

2 participants


Snippets does not get loaded. Happens when I run (yas/reload-all) or (yas/load-snippet-dirs). Snippets do get loaded when I run (yas/load-directory dirname). My yas/snippet-dirs does exist (as set by default).


Snippets are now, by default, loaded as needed (just-in-time loading). Can you provide a bullet proof example reproducing your problem (preferably one starting with emacs -Q).


Oh, now I see what's causing it. I am not loading yas globally, I only load yas when I need it, like this:

(add-hook 'prog-mode-hook
          '(lambda ()

This appears not to be supported by the jit loading. Is the definitive solution to use yas globally? It feels superfluous to have yas enabled all the time, even when I don't want/need it.

To be clear; reproducing this by opening emacs with -Q and doing

(add-to-list 'load-path
(require 'yasnippet)

then opening some buffer in a mode that is supposed to have yas snippets, and running (yas/minor-mode), then realize that there still are no snippets.

In this case there are still no snippets even after doing (yas/load-snippet-dirs) or (yas/reload-all). I should note that it all works as intended if I use (yas/global-mode 1.


oh, I see. Your use case (not using yas/global-mode) is definitely supported, but I'm afraid I didn't test it thoroughly. Will do so asap and report back here. But on a first glance it should work if you call (yas/reload-all) just after the (require 'yasnippet) in your .emacs. The problem seems to be buffers where you activated yas/minor-mode before calling yas/reload-all. These aren't seen by subsequent calls to yas/reload-all, can you try "M-x yas/minor-mode" twice in those buffers and see if it helps?


Adding (yas/reload-all) after (require 'yasnippet) does work! However, if I don't do that, and enable (yas/minor-mode) in some buffer, I can not get snippets to load regardless of how many times I do (yas/reload-all). So right now one has to do (yas/reload-all) before (yas/minor-mode) is entered. And if (yas/minor-mode) is entered before reload-all, one has to leave and then enter the mode again for snippets to get loaded.


OK I've analysed this and decided the safest option is to tell users that wish to use yas/minor-mode non-globally is to add a call to (yas/reload-all) instead of (yas/global-mode 1)

@joaotavora joaotavora closed this Jun 28, 2012
@joaotavora joaotavora reopened this Aug 3, 2012

A possible solution would be for yas-minor-mode to check wheter there are pending loads for the major mode entered previously.


There are actually two separate issues here. When not using yas-global-mode:

  • Entering yas-minor-mode in <some-major-mode> before yas-load-directory or yas-reload-all (these calls using JIT-loading). yas-load-directory will not relize there are buffers where yas-minor-mode is already active the snippet load for <some-major-mode> will remain scheduled, where it should have been performed immediately.

  • Entering yas-minor-mode after yas-load-directory or yas-reload-all. yas-minor-mode doesn't check if there are scheduled loads for <some-major-mode> and that snippet load will remained scheduled.

I'll have to analyse this more thoroughly next week.

@joaotavora joaotavora added a commit that closed this issue Nov 6, 2012
@joaotavora Closes #253. 185c771
@joaotavora joaotavora closed this in 185c771 Nov 6, 2012

Ok so I closed this, if you're still there :-) please test and report any feedback here. The second case was apparently already taken care of, it was the first case that was still problematic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment