Function: tempel-expand

tempel-expand is an interactive and natively compiled function defined in tempel.el.

Signature

(tempel-expand &optional INTERACTIVE)

Documentation

Expand exactly matching template name at point.

This completion-at-point-function (Capf) returns only the single exactly matching template name. As a consequence the completion UI (e.g. Corfu) does not present the candidates for selection. If you want to select from a list of templates, use tempel-complete instead. If INTERACTIVE is nil the function acts like a Capf, otherwise like an interactive completion command.

Key Bindings

This command is not in any keymaps.

Source Code

;; Defined in /nix/store/b3ibjbs2i12kyhwapibfx6i39f025i85-emacs-packages-deps/share/emacs/site-lisp/elpa/tempel-20260705.1258/tempel.el
;;;###autoload
(defun tempel-expand (&optional interactive)
  "Expand exactly matching template name at point.
This completion-at-point-function (Capf) returns only the single
exactly matching template name.  As a consequence the completion
UI (e.g. Corfu) does not present the candidates for selection.
If you want to select from a list of templates, use
`tempel-complete' instead.  If INTERACTIVE is nil the function
acts like a Capf, otherwise like an interactive completion
command."
  (interactive (list t))
  (when interactive
    (tempel--save))
  (if-let* ((templates (tempel--templates))
            (bounds (tempel--prefix-bounds templates))
            (name (buffer-substring-no-properties
                   (car bounds) (cdr bounds)))
            (sym (intern-soft name))
            (template (assq sym templates)))
      (if interactive
          (tempel--exit templates nil name 'finished)
        (setq templates (list template))
        (list (car bounds) (cdr bounds) templates
              :category 'tempel
              :exclusive 'no
              :exit-function (apply-partially #'tempel--exit templates nil)))
    (when interactive (user-error "tempel-expand: No matching templates"))))