Function: tempel--file-prepare
tempel--file-prepare is a natively compiled function defined in
tempel.el.
Signature
(tempel--file-prepare DATA)
Documentation
Reorganize the template DATA from file.
DATA must be a list (MODES PLIST TEMPLATES MODES PLIST TEMPLATES...). See the README, which provides an example for the file format of the template.eld file. The return value is a list of elements of the form (MODE COND . TEMPLATES).
Source Code
;; Defined in /nix/store/b3ibjbs2i12kyhwapibfx6i39f025i85-emacs-packages-deps/share/emacs/site-lisp/elpa/tempel-20260705.1258/tempel.el
(defun tempel--file-prepare (data)
"Reorganize the template DATA from file.
DATA must be a list (MODES PLIST TEMPLATES MODES PLIST TEMPLATES...).
See the README, which provides an example for the file format of the
template.eld file. The return value is a list of elements of the
form (MODE COND . TEMPLATES)."
(let (result)
(while data
(let (modes plist templates)
(while (and (car data) (symbolp (car data)) (not (keywordp (car data))))
(push (pop data) modes))
(while (keywordp (car data))
(setq plist `(,(car data) ,(cadr data) ,@plist)
data (cddr data)))
(while (consp (car data))
(push (pop data) templates))
(setq plist (or (not (plist-member plist :when)) (plist-get plist :when))
templates (nreverse templates))
(dolist (mode modes)
(push `(,mode ,plist ,@templates) result))))
result))