Function: tempo-insert-template

tempo-insert-template is a byte-compiled function defined in tempo.el.gz.

Signature

(tempo-insert-template TEMPLATE ON-REGION)

Documentation

Insert a template.

TEMPLATE is the template to be inserted. If ON-REGION is non-nil the r elements are replaced with the current region. In Transient Mark mode, ON-REGION is ignored and assumed true if the region is active.

Source Code

;; Defined in /usr/src/emacs/lisp/tempo.el.gz
;;;
;;; tempo-insert-template

(defun tempo-insert-template (template on-region)
  "Insert a template.
TEMPLATE is the template to be inserted.  If ON-REGION is non-nil the
`r' elements are replaced with the current region.  In Transient Mark
mode, ON-REGION is ignored and assumed true if the region is active."
  (unwind-protect
      (progn
	(if (or (and transient-mark-mode
		     mark-active))
	    (setq on-region t))
	(and on-region
	     (set-marker tempo-region-start (min (mark) (point)))
	     (set-marker tempo-region-stop (max (mark) (point))))
	(if on-region
	    (goto-char tempo-region-start))
	(save-excursion
	  (tempo-insert-mark (point-marker))
          (mapc (lambda (elt)
                  (tempo-insert elt on-region))
		(symbol-value template))
	  (tempo-insert-mark (point-marker)))
	(tempo-forward-mark))
    (tempo-forget-insertions)
    (and transient-mark-mode
	 (deactivate-mark))))