Function: semantic-analyze-current-context

semantic-analyze-current-context is an autoloaded, interactive and byte-compiled function defined in analyze.el.gz.

Signature

(semantic-analyze-current-context &optional POSITION)

Documentation

Analyze the current context at optional POSITION.

If called interactively, display interesting information about POSITION in a separate buffer. Returns an object based on symbol semantic-analyze-context(var)/semantic-analyze-context(fun).

This function can be overridden with the symbol analyze-context. When overriding this function, your override will be called while cursor is at POSITION. In addition, your function will not be called if a cached copy of the return object is found.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/cedet/semantic/analyze.el.gz
;;; MAIN ANALYSIS
;;
;; Create a full-up context analysis.
;;
;;;###autoload
(define-overloadable-function semantic-analyze-current-context (&optional position)
  "Analyze the current context at optional POSITION.
If called interactively, display interesting information about POSITION
in a separate buffer.
Returns an object based on symbol `semantic-analyze-context'.

This function can be overridden with the symbol `analyze-context'.
When overriding this function, your override will be called while
cursor is at POSITION.  In addition, your function will not be called
if a cached copy of the return object is found."
  (interactive "d")
  ;; Only do this in a Semantic enabled buffer.
  (when (not (semantic-active-p))
    (error "Cannot analyze buffers not supported by Semantic"))
  ;; Always refresh out tags in a safe way before doing the
  ;; context.
  (semantic-refresh-tags-safe)
  ;; Do the rest of the analysis.
  (if (not position) (setq position (point)))
  (save-excursion
    (goto-char position)
    (let* ((answer (semantic-get-cache-data 'current-context)))
      (with-syntax-table semantic-lex-syntax-table
	(when (not answer)
	  (setq answer (:override))
	  (when (and answer (oref answer bounds))
	    (with-slots (bounds) answer
	      (semantic-cache-data-to-buffer (current-buffer)
					     (car bounds)
					     (cdr bounds)
					     answer
					     'current-context
					     'exit-cache-zone)))
	  ;; Check for interactivity
	  (when (called-interactively-p 'any)
	    (if answer
		(semantic-analyze-pop-to-context answer)
	      (message "No Context."))
	    ))

	answer))))