Function: semantic-show-parser-state-mode

semantic-show-parser-state-mode is an autoloaded, interactive and byte-compiled function defined in util-modes.el.gz.

Signature

(semantic-show-parser-state-mode &optional ARG)

Documentation

Minor mode for displaying parser cache state in the modeline.

The cache can be in one of three states. They are Up to date, Partial reparse needed, and Full reparse needed. The state is indicated in the modeline with the following characters:
 - -> The cache is up to date.
 ! -> The cache requires a full update.
 ~ -> The cache needs to be incrementally parsed.
 % -> The cache is not currently parsable.
 @ -> Auto-parse in progress (not set here.)

The minor mode can be turned on only if semantic feature is available and the current buffer was set up for parsing. Return non-nil if the minor mode is enabled.

This is a minor mode. If called interactively, toggle the Semantic-Show-Parser-State mode mode. If the prefix argument is positive, enable the mode, and if it is zero or negative, disable the mode.

If called from Lisp, toggle the mode if ARG is toggle. Enable the mode if ARG is nil, omitted, or is a positive number. Disable the mode if ARG is a negative number.

To check whether the minor mode is enabled in the current buffer, evaluate semantic-show-parser-state-mode(var)/semantic-show-parser-state-mode(fun).

The mode's hook is called both when the mode is enabled and when it is disabled.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/cedet/semantic/util-modes.el.gz
;;;###autoload
(define-minor-mode semantic-show-parser-state-mode
  "Minor mode for displaying parser cache state in the modeline.
The cache can be in one of three states.  They are
Up to date, Partial reparse needed, and Full reparse needed.
The state is indicated in the modeline with the following characters:
 `-'  ->  The cache is up to date.
 `!'  ->  The cache requires a full update.
 `~'  ->  The cache needs to be incrementally parsed.
 `%'  ->  The cache is not currently parsable.
 `@'  ->  Auto-parse in progress (not set here.)

The minor mode can be turned on only if semantic feature is
available and the current buffer was set up for parsing.  Return
non-nil if the minor mode is enabled."
  :keymap semantic-show-parser-state-mode-map
  (if semantic-show-parser-state-mode
      (if (not (and (featurep 'semantic) (semantic-active-p)))
          (progn
            ;; Disable minor mode if semantic stuff not available
            (setq semantic-show-parser-state-mode nil)
            (error "Buffer %s was not set up for parsing"
                   (buffer-name)))
	;; Set up mode line

	(when (not
	       (memq 'semantic-show-parser-state-string mode-line-modified))
	  (setq mode-line-modified
		(append mode-line-modified
			'(semantic-show-parser-state-string))))
	;; Add hooks
        (add-hook 'semantic-edits-new-change-functions
                  #'semantic-show-parser-state-marker nil t)
	(add-hook 'semantic-edits-incremental-reparse-failed-hook
		  #'semantic-show-parser-state-marker nil t)
	(add-hook 'semantic-after-partial-cache-change-hook
		  #'semantic-show-parser-state-marker nil t)
	(add-hook 'semantic-after-toplevel-cache-change-hook
		  #'semantic-show-parser-state-marker nil t)
	(semantic-show-parser-state-marker)

	(add-hook 'semantic-before-auto-parse-hooks
		  #'semantic-show-parser-state-auto-marker nil t)
	(add-hook 'semantic-after-auto-parse-hooks
		  #'semantic-show-parser-state-marker nil t)

	(add-hook 'semantic-before-idle-scheduler-reparse-hook
		  #'semantic-show-parser-state-auto-marker nil t)
	(add-hook 'semantic-after-idle-scheduler-reparse-hook
		  #'semantic-show-parser-state-marker nil t))
    ;; Remove parts of mode line
    (setq mode-line-modified
	  (delq 'semantic-show-parser-state-string mode-line-modified))
    ;; Remove hooks
    (remove-hook 'semantic-edits-new-change-functions
		 #'semantic-show-parser-state-marker t)
    (remove-hook 'semantic-edits-incremental-reparse-failed-hook
		 #'semantic-show-parser-state-marker t)
    (remove-hook 'semantic-after-partial-cache-change-hook
		 #'semantic-show-parser-state-marker t)
    (remove-hook 'semantic-after-toplevel-cache-change-hook
		 #'semantic-show-parser-state-marker t)

    (remove-hook 'semantic-before-auto-parse-hooks
		 #'semantic-show-parser-state-auto-marker t)
    (remove-hook 'semantic-after-auto-parse-hooks
		 #'semantic-show-parser-state-marker t)

    (remove-hook 'semantic-before-idle-scheduler-reparse-hook
		 #'semantic-show-parser-state-auto-marker t)
    (remove-hook 'semantic-after-idle-scheduler-reparse-hook
		 #'semantic-show-parser-state-marker t)))