0

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
         "~/.emacs.d/elpa/yasnippet-20160801.1142")
(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!

2

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, privacy policy and cookie policy

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