Insert yasnippet by name
emacs, yasnippet
Solution
`yas/insert-snippet` is indeed just a thin wrapper around `yas/expand-snippet` for interactive use. However, the internal structures are... interesting. Judging from the source code the following does work for me when I want to expand the "defun" snippet in elisp-mode:
(yas/expand-snippet
(yas/template-content (cdar (mapcan #'(lambda (table)
(yas/fetch table "defun"))
(yas/get-snippet-tables)))))
Problem
I want to insert a specific yasnippet as part of a function in emacs-lisp. Is there a way to do that? The only command that seems related is `yas/insert-snippet`, but it simply opens a popup with all the options and the documentation doesn't say anything about bypassing the popup by specifing the snippet name.