Function: semantic-analyze-possible-completions

semantic-analyze-possible-completions is an autoloaded, interactive and byte-compiled function defined in complete.el.gz.

Signature

(semantic-analyze-possible-completions CONTEXT &rest FLAGS)

Documentation

Return a list of semantic tags which are possible completions.

CONTEXT is either a position (such as point), or a precalculated context. Passing in a context is useful if the caller also needs to access parts of the analysis. The remaining FLAGS arguments are passed to the mode specific completion engine. Bad flags should be ignored by modes that don't use them. See semantic-analyze-possible-completions-default for details on the default FLAGS.

Completions run through the following filters:
  * Elements currently in scope
  * Constants currently in scope
  * Elements match the :prefix in the CONTEXT.
  * Type of the completion matches the type of the context.
Context type matching can identify the following:
  * No specific type
  * Assignment into a variable of some type.
  * Argument to a function with type constraints.
When called interactively, displays the list of possible completions in a buffer.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/cedet/semantic/analyze/complete.el.gz
;;; MAIN completion calculator
;;
;;;###autoload
(define-overloadable-function semantic-analyze-possible-completions (context &rest flags)
  "Return a list of semantic tags which are possible completions.
CONTEXT is either a position (such as point), or a precalculated
context.  Passing in a context is useful if the caller also needs
to access parts of the analysis.
The remaining FLAGS arguments are passed to the mode specific completion engine.
Bad flags should be ignored by modes that don't use them.
See `semantic-analyze-possible-completions-default' for details
on the default FLAGS.

Completions run through the following filters:
  * Elements currently in scope
  * Constants currently in scope
  * Elements match the :prefix in the CONTEXT.
  * Type of the completion matches the type of the context.
Context type matching can identify the following:
  * No specific type
  * Assignment into a variable of some type.
  * Argument to a function with type constraints.
When called interactively, displays the list of possible completions
in a buffer."
  (interactive "d")
  ;; In theory, we don't need the below since the context will
  ;; do it for us.
  ;;(semantic-refresh-tags-safe)
  (if (semantic-active-p)
    (with-syntax-table semantic-lex-syntax-table
      (let* ((context (if (cl-typep context 'semantic-analyze-context)
			  context
			(semantic-analyze-current-context context)))
	     (ans (if (not context)
		      (when (called-interactively-p 'any)
			(error "Nothing to complete"))
		    (with-demoted-errors "%S"
		      (:override)))))
	;; If interactive, display them.
	(when (called-interactively-p 'any)
	  (with-output-to-temp-buffer "*Possible Completions*"
	    (semantic-analyze-princ-sequence ans "" (current-buffer)))
	  (shrink-window-if-larger-than-buffer
	   (get-buffer-window "*Possible Completions*")))
	ans))
    ;; Buffer was not parsed by Semantic.
    ;; Raise error if called interactively.
    (when (called-interactively-p 'any)
      (error "Buffer was not parsed by Semantic"))))