Closed ispringle closed 1 year ago
Something like this?
(defun tempel-eval ()
(interactive)
(let ((template (read (buffer-substring-no-properties
(region-beginning) (region-end)))))
(delete-region (region-beginning) (region-end))
(tempel-insert template)))
EDIT: After rereading your issue again, I think you want something else, which redefines a template? You can define a variable which holds a list of templates, see https://github.com/minad/tempel#adding-template-sources. Then your tempel-eval
command could add to this list.
Thanks for the help, I'll get a look at this tomorrow at work. Really appreciate it.
Hello, thanks for this great project. I'm wondering how to go about writing a
tempel-eval
/eval-tempel
function. The idea here is a function that can evaluate the region highlighted, similar toeval-region
but the evaluated region is consumed by tempel as a new snippet, or overwriting the previously defined snippet.I'd be happy to do the work to get this implemented, but I was hoping for some guidance here. My lisp skills are pretty subpar and while I've read
tempel.el
I'm a bit confused how to get about this. I know it's possible since there is an auto reload function to reload the tempel files on save.