Function: tempo-complete-tag

tempo-complete-tag is an interactive and byte-compiled function defined in tempo.el.gz.

Signature

(tempo-complete-tag &optional SILENT)

Documentation

Look for a tag and expand it.

All the tags in the tag lists in tempo-local-tags
(this includes tempo-tags) are searched for a match for the text
before the point. The way the string to match for is determined can be altered with the variable tempo-match-finder. If tempo-match-finder returns nil, then the results are the same as no match at all.

If a single match is found, the corresponding template is expanded in place of the matching string.

If a partial completion or no match at all is found, and SILENT is non-nil, the function will give a signal.

If a partial completion is found and tempo-show-completion-buffer is non-nil, a buffer containing possible completions is displayed.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/tempo.el.gz
;;;
;;; tempo-complete-tag

(defun tempo-complete-tag (&optional silent)
  "Look for a tag and expand it.
All the tags in the tag lists in `tempo-local-tags'
\(this includes `tempo-tags') are searched for a match for the text
before the point.  The way the string to match for is determined can
be altered with the variable `tempo-match-finder'.  If
`tempo-match-finder' returns nil, then the results are the same as
no match at all.

If a single match is found, the corresponding template is expanded in
place of the matching string.

If a partial completion or no match at all is found, and SILENT is
non-nil, the function will give a signal.

If a partial completion is found and `tempo-show-completion-buffer' is
non-nil, a buffer containing possible completions is displayed."

  ;; This function may look like a hack, but this is how I want it to
  ;; work.
  (interactive "*")
  (let* ((collection (tempo-build-collection))
	 (match-info (tempo-find-match-string tempo-match-finder))
	 (match-string (car match-info))
	 (match-start (cdr match-info))
	 (exact (assoc match-string collection))
	 (compl (or (car exact)
		    (and match-info (try-completion match-string collection)))))
    (if compl (delete-region match-start (point)))
    (cond ((null match-info) (or silent (ding)))
	  ((null compl) (or silent (ding)))
	  ((eq compl t) (tempo-insert-template
			 (cdr (assoc match-string
				     collection))
			 nil))
	  (t (if (setq exact (assoc compl collection))
		 (tempo-insert-template (cdr exact) nil)
	       (insert compl)
	       (or silent (ding))
	       (if tempo-show-completion-buffer
		   (tempo-display-completions match-string
					      collection)))))))