Function: org-fill-template

org-fill-template is a byte-compiled function defined in org-macs.el.gz.

Signature

(org-fill-template TEMPLATE ALIST)

Documentation

Find each %key of ALIST in TEMPLATE and replace it.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-macs.el.gz
(defun org-fill-template (template alist)
  "Find each %key of ALIST in TEMPLATE and replace it."
  (let ((case-fold-search nil))
    (dolist (entry (sort (copy-sequence alist)
                         ; Sort from longest key to shortest, so that
                         ; "noweb-ref" and "tangle-mode" get processed
                         ; before "noweb" and "tangle", respectively.
                         (lambda (a b) (< (length (car b)) (length (car a))))))
      (setq template
	    (replace-regexp-in-string
	     (concat "%" (regexp-quote (car entry)))
	     (or (cdr entry) "") template t t)))
    template))