Templates and Snippets in Emacs
I was only trying to write that last article, but it took me days to finally do it. I had so much work to do before I got there.
I had come to appreciate Emacs automatically inserting the boilerplate namespace declarations in new Clojure files, and I really thought I needed such convenience for my blog posts written in AsciiDoc in JBake. I dove down a 20-tab-deep, yak-shaving hole to get it done. 
I had to figure out the right search terms
and names for what Emacs was doing for me.
I finally found yatemplate
which seems similar to yasnippets.
has the templates layer
for integrating yatemplate support,
so I added that layer and created a template
adoc files in my
My simple case worked,
but I recognized
that I’ll want that template
on all my machines,
so having a local copy of it
wouldn’t cut it.
I needed a way to check-in and version more Emacs/Spacemacs files
than just my
~/.spacemacs files I was previously distributing.
I learned yasnippets would default
to looking in
if the configuration was in there,
so I had to move my
To have the templates layer source templates
it required an extra bit of configuration
when introducing it to the
(templates :variables templates-private-directory "~/.spacemacs.d/templates")
At this point,
I could now commit
with the regular configuration file
and the supporting templates and snippets.
All those files will be cloned
to all my workstations.
I was almost ready to write
but yasnippet and yatemplate
have this fancy templating language.
I’m sure that can make
my article-creation even smarter!
I read a bit more
and found a couple cool
for automatically filling in the date
and building a title
from the file name.
With the final enhancements
I could write the article,
if I could only remember
what I was trying to do
in the first place.
I hope to at least remember
how to use these snippets and templates
for future work.