Closed Luis-Henriquez-Perez closed 4 years ago
Thanks for sharing! It's an interesting idea. I think it's worth experimenting to see if the syntax ends up being easier to reason about and maintain. However, I don't use yasnippet as heavily as I do org-capture, so unfortunately I can't comment much on your implementation. Some general notes:
I originally wrote doct as a macro. It turned out it didn't need to be one! A regular function did the job just fine. I suspect this may be the case for doing something similar with yasnippets.
Would it be useful to implement some sort of inheritance similar to doct's? This would allow common elements to be shared between snippets. Not sure if it is or not, but worth consideration.
You may be able to simplify the syntax. If you're accessing the various elements like a plist, you could just use that as your data structure. Perhaps something like:
(defsnippet
'(:name "help-function"
:mode org-mode
:keys "hfn"
:body "[[helpfn:$1][%s]]$0"
:1 (yas-auto-next (yas-choose-value (void-list-symbols #'functionp)))))
I encourage you to continue experimenting with it. If you do end up writing a package, make sure to keep me posted. I'll definitely look it over and offer up any advice I can.
I am very grateful for your advice and I will keep you posted. Thank you.
I just wanted to mention that I really like this idea and I would love to see it applied to yasnippet templates. I don't like having snippets in a multiple separate files. And I don't like writing snippets in non lisp. Sometimes I end up with one snippet that's a huge long line.
Here's an example of what it might look like:
Here's what the macro I wrote to do this looks like:
It uses the dash libraries and some helper functions/macros I wrote. I might end up writing a package for this I'm not sure yet. I just wanted to ask you if this is something that seems interesting to you.