Emacs module that generates templates for my blog's static site generator
DRY-ing it up:

It looks like variation is in:


how the filename is obtained
the contents of the inserted text
the name of the file to write to.


Also note that if format is given extra arguments not needed by its format-spec that they are ignored.

So you could define a function which takes 3 arguments: the function to call to get the filename to read from, the file-name to write to, and a the format-spec string.

In order to pass a named function to a method you need to quote it as in the example:

(mapcar '1+ '(1 2 3))


If you want to pass an anonymous function to a function you defined it with #'(lambda ...). For example:

(mapcar #'(lambda (x) (1+ x)) '(1 2 3))


Making a configuration setting

I'd suggest changing your hakyll-site-location function into a variable. Use defvar to define it and then you can simply setq it in your emacs dotfiles.