Function: semantic-complete-default-to-tag
semantic-complete-default-to-tag is a byte-compiled function defined
in complete.el.gz.
Signature
(semantic-complete-default-to-tag DEFAULT)
Documentation
Convert a calculated or passed in DEFAULT into a tag.
Source Code
;; Defined in /usr/src/emacs/lisp/cedet/semantic/complete.el.gz
(defun semantic-complete-default-to-tag (default)
"Convert a calculated or passed in DEFAULT into a tag."
(if (semantic-tag-p default)
;; Just return what was passed in.
(setq semantic-complete-active-default default)
;; If none was passed in, guess.
(if (null default)
(setq default (semantic-ctxt-current-thing)))
(if (null default)
;; Do nothing
nil
;; Turn default into something useful.
(let ((str
(cond
;; Semantic-ctxt-current-symbol will return a list of
;; strings. Technically, we should use the analyzer to
;; fully extract what we need, but for now, just grab the
;; first string
((and (listp default) (stringp (car default)))
(car default))
((stringp default)
default)
((symbolp default)
(symbol-name default))
(t
(signal 'wrong-type-argument
(list default 'semantic-tag-p)))))
(tag nil))
;; Now that we have that symbol string, look it up using the active
;; collector. If we get a match, use it.
(save-excursion
(semantic-collector-calculate-completions
semantic-completion-collector-engine
str nil))
;; Do we have the perfect match???
(let ((ml (semantic-collector-current-exact-match
semantic-completion-collector-engine)))
(when ml
;; We don't care about uniqueness. Just guess for convenience
(setq tag (semanticdb-find-result-nth-in-buffer ml 0))))
;; save it
(setq semantic-complete-active-default tag)
;; Return it.. .whatever it may be
tag))))