Function: semantic-show-unmatched-syntax-mode

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

Signature

(semantic-show-unmatched-syntax-mode &optional ARG)

Documentation

Minor mode to highlight unmatched lexical syntax tokens.

When a parser executes, some elements in the buffer may not match any parser rules. These text characters are considered unmatched syntax. Often time, the display of unmatched syntax can expose coding problems before the compiler is run.

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.

C-c , ` semantic-show-unmatched-syntax-next

This is a minor mode. If called interactively, toggle the Semantic-Show-Unmatched-Syntax 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-unmatched-syntax-mode(var)/semantic-show-unmatched-syntax-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-unmatched-syntax-mode
  "Minor mode to highlight unmatched lexical syntax tokens.
When a parser executes, some elements in the buffer may not match any
parser rules.  These text characters are considered unmatched syntax.
Often time, the display of unmatched syntax can expose coding
problems before the compiler is run.

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.

\\{semantic-show-unmatched-syntax-mode-map}"
  :keymap semantic-show-unmatched-syntax-mode-map
  (if semantic-show-unmatched-syntax-mode
      (if (not (and (featurep 'semantic) (semantic-active-p)))
          (progn
            ;; Disable minor mode if semantic stuff not available
            (setq semantic-show-unmatched-syntax-mode nil)
            (error "Buffer %s was not set up for parsing"
                   (buffer-name)))
        ;; Add hooks
        (add-hook 'semantic-unmatched-syntax-hook
                  #'semantic-show-unmatched-syntax nil t)
	(add-hook 'semantic-pre-clean-token-hooks
		  #'semantic-clean-token-of-unmatched-syntax nil t)
        ;; Show unmatched syntax elements
	(if (not (semantic--umatched-syntax-needs-refresh-p))
	    (semantic-show-unmatched-syntax
	     (semantic-unmatched-syntax-tokens))))
    ;; Remove hooks
    (remove-hook 'semantic-unmatched-syntax-hook
                 #'semantic-show-unmatched-syntax t)
    (remove-hook 'semantic-pre-clean-token-hooks
		 #'semantic-clean-token-of-unmatched-syntax t)
    ;; Cleanup unmatched-syntax highlighting
    (semantic-clean-unmatched-syntax-in-buffer)))