Function: tempel-key

tempel-key is a macro defined in tempel.el.

Signature

(tempel-key KEY TEMPLATE-OR-NAME &optional MAP)

Documentation

Bind KEY to TEMPLATE-OR-NAME in MAP.

Source Code

;; Defined in /nix/store/b3ibjbs2i12kyhwapibfx6i39f025i85-emacs-packages-deps/share/emacs/site-lisp/elpa/tempel-20260705.1258/tempel.el
;;;###autoload
(defmacro tempel-key (key template-or-name &optional map)
  "Bind KEY to TEMPLATE-OR-NAME in MAP."
  (unless (key-valid-p key)
    (error "Invalid key %s" key))
  `(define-key
    ,(or map 'global-map) ,(key-parse key)
    ,(if (consp template-or-name)
         `(lambda ()
            (interactive)
            (tempel-insert ',template-or-name))
       (let ((cmd (intern (format "tempel-insert-%s" template-or-name))))
         `(prog1 ',cmd
            (defun ,cmd ()
              ,(format "Insert template %s in the current buffer."
                       template-or-name)
              (interactive)
              (tempel-insert ',template-or-name)))))))