my question is pretty basic but I don't know how to create yasnippets properly. I have created some snippets for Java or html with yas-new-snippets, installed them under emacs.d/snippets/org-mode, but they only work when I invoke them from org-mode , not from Java-mode (or JDEE) or html-mode, which is not very useful...

Here is my config file:

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

The variable yas-snippet-dirs yields: ("~/.emacs.d/snippets" "/Users/me/.emacs.d/snippets" yas-installed-snippets-dir) so I tried to put directly under .emacs.d/snippets/ but they are not recognized.

Any idea? Thanks!

1 Answer 1


Did you use the right table ? yas-new-snippet creates the snippets for org mode if you use it in an org-mode buffer, except you changed the table manually. In other words, each major-mode got its own snippets and snippet directory.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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