I try to create a snippet which needs a little elisp code (about 15 lines). I don't want to put all the code there to make the snippet looks very ugly. A function call is the best choice. But I am not sure where should I put the code for that function.
For example: (Ugly)
${1: $(supper long elisp code here)}
I expect something like:
${1: $(my-function arg)}
Then where should I put my-function code?
You can place the code in your initialization file. The function just needs to be defined before call yas-expand
.
(Edited to include followup from comments.)
You can also create a .yas-snippet.el file in the same directory as the snippet with your function (example).