Function: semantic-ia-complete-symbol
semantic-ia-complete-symbol is an autoloaded, interactive and
byte-compiled function defined in ia.el.gz.
Signature
(semantic-ia-complete-symbol &optional POS)
Documentation
Complete the current symbol at POS.
If POS is nil, default to point.
Completion options are calculated with semantic-analyze-possible-completions.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/cedet/semantic/ia.el.gz
;;;###autoload
(defun semantic-ia-complete-symbol (&optional pos)
"Complete the current symbol at POS.
If POS is nil, default to point.
Completion options are calculated with `semantic-analyze-possible-completions'."
(interactive "d")
(when (semantic-active-p)
(or pos (setq pos (point)))
;; Calculating completions is a two step process.
;;
;; The first analyzer the current context, which finds tags for
;; all the stuff that may be references by the code around POS.
;;
;; The second step derives completions from that context.
(let* ((a (semantic-analyze-current-context pos))
(syms (semantic-analyze-possible-completions a))
(pre (car (reverse (oref a prefix)))))
;; If PRE was actually an already completed symbol, it doesn't
;; come in as a string, but as a tag instead.
(if (semantic-tag-p pre)
;; We will try completions on it anyway.
(setq pre (semantic-tag-name pre)))
;; Complete this symbol.
(if (null syms)
(if (semantic-analyze-context-p a)
;; This is a clever hack. If we were unable to find any
;; smart completions, let's divert to how senator derives
;; completions.
;;
;; This is a way of making this fcn more useful since
;; the smart completion engine sometimes fails.
(semantic-complete-symbol))
;; Use try completion to seek a common substring.
(let* ((completion-ignore-case (string= (downcase pre) pre))
(tc (try-completion (or pre "") syms)))
(if (and (stringp tc) (not (string= tc (or pre ""))))
(let ((tok (semantic-find-first-tag-by-name
tc syms)))
;; Delete what came before...
(when (and (car (oref a bounds)) (cdr (oref a bounds)))
(delete-region (car (oref a bounds))
(cdr (oref a bounds)))
(goto-char (car (oref a bounds))))
;; We have some new text. Stick it in.
(if tok
(semantic-ia-insert-tag tok)
(insert tc)))
;; We don't have new text. Show all completions.
(when (cdr (oref a bounds))
(goto-char (cdr (oref a bounds))))
(with-output-to-temp-buffer "*Completions*"
(display-completion-list
(mapcar semantic-ia-completion-format-tag-function syms)))))))))