I am unable to set up yasnippet the way I want to set it up.
I only want to use yasnippet for a particular set of modes, so I don't want to use yas-global-mode
.
I only want to use my own snippets, not the ones that come pre-packaged with the MELPA installation. I don't want it to ever load the MELPA snippets.
Unfortunately, the package is being insufferable; the only way I can figure out how to add my snippets and get them to actually work is to do the following:
(require 'yasnippet)
;; Use custom snippets.
(add-to-list 'yas-snippet-dirs "~/Dropbox/configs/emacs/snippets/")
(yas-reload-all)
(dolist (hook jrh-programming-modes)
(add-hook hook 'yas-minor-mode))
I have to call yas-reload-all
, or else my snippets aren't available. I have to use add-to-list
, because for some reason, when I replace that line with (setq yas-snippet-dirs '("~/Dropbox/configs/emacs/snippets/"))
, my snippets are not loaded. So I have to suffer through the loading of all the other snippets, which I never use.
What I would like to do is this:
;; Use custom snippets.
(setq yas-snippet-dirs '("~/Dropbox/configs/emacs/snippets/"))
(require 'yasnippet)
(dolist (hook jrh-programming-modes)
(add-hook hook 'yas-minor-mode))
and never need to use the other snippets or reload at all. Of course, the above code does not work, even though in my head it seems like it should.
Any help on how to accomplish this would be greatly appreciated.