Function: tempel-insert

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

Signature

(tempel-insert TEMPLATE-OR-NAME)

Documentation

Insert TEMPLATE-OR-NAME.

If called interactively, select a template with completing-read.

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-insert (template-or-name)
  "Insert TEMPLATE-OR-NAME.
If called interactively, select a template with `completing-read'."
  (interactive (list nil))
  (tempel--insert
   (if (consp template-or-name) template-or-name
     (let ((templates (or (tempel--templates)
                          (error "Tempel: No templates for %s" major-mode))))
       (unless template-or-name
         (setq template-or-name
               (intern-soft
                (completing-read
                 "Template: "
                 (completion-table-with-metadata
                  templates
                  `((category . tempel)
                    ,@(when tempel-insert-annotation
                        `((annotation-function
                           . ,(apply-partially
                               #'tempel--annotate templates tempel-insert-annotation
                               #("  " 1 2 (display (space :align-to (+ left 20))))))))))
                 nil t nil 'tempel--history))))
       (or (and template-or-name (alist-get template-or-name templates))
           (user-error "Template %s not found" template-or-name))))
   (tempel--region)))