Variable: semantic-mode

semantic-mode is a customizable variable defined in semantic.el.gz.

Value

nil

Documentation

Non-nil if Semantic mode is enabled.

See the semantic-mode(var)/semantic-mode(fun) command for a description of this minor mode. Setting this variable directly does not take effect; either customize it (see the info node (emacs)Easy Customization) or call the function semantic-mode(var)/semantic-mode(fun).

Probably introduced at or before Emacs version 23.2.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/cedet/semantic.el.gz
;;;###autoload
(define-minor-mode semantic-mode
  "Toggle parser features (Semantic mode).

In Semantic mode, Emacs parses the buffers you visit for their
semantic content.  This information is used by a variety of
auxiliary minor modes, listed in `semantic-default-submodes';
all the minor modes in this list are also enabled when you enable
Semantic mode.

\\{semantic-mode-map}"
  :global t
  :group 'semantic
  (if semantic-mode
      ;; Turn on Semantic mode
      (progn
	;; Enable all the global auxiliary minor modes in
	;; `semantic-submode-list'.
	(dolist (mode semantic-submode-list)
	  (and (memq mode semantic-default-submodes)
	       (fboundp mode)
	       (funcall mode 1)))
	(unless semantic-load-system-cache-loaded
	  (setq semantic-load-system-cache-loaded t)
	  (when (and (boundp 'semanticdb-default-system-save-directory)
		     (stringp semanticdb-default-system-save-directory)
		     (file-exists-p semanticdb-default-system-save-directory))
	    (require 'semantic/db-ebrowse)
	    (semanticdb-load-ebrowse-caches)))
	(add-hook 'mode-local-init-hook #'semantic-new-buffer-fcn)
	;; Add semantic-ia-complete-symbol to
	;; completion-at-point-functions, so that it is run from
	;; M-TAB.
	;;
	;; Note: The first entry added is the last entry run, so the
	;;       most specific entry should be last.
	(add-hook 'completion-at-point-functions
		  #'semantic-analyze-nolongprefix-completion-at-point-function)
	(add-hook 'completion-at-point-functions
		  #'semantic-analyze-notc-completion-at-point-function)
	(add-hook 'completion-at-point-functions
		  #'semantic-analyze-completion-at-point-function)

	(if (bound-and-true-p global-ede-mode)
	    (define-key cedet-menu-map [cedet-menu-separator] '("--")))
	(dolist (b (buffer-list))
	  (with-current-buffer b
	    (semantic-new-buffer-fcn))))
    ;; Disable Semantic features.  Removing everything Semantic has
    ;; introduced in the buffer is pretty much futile, but we have to
    ;; clean the hooks and delete Semantic-related overlays, so that
    ;; Semantic can be re-activated cleanly.
    (remove-hook 'mode-local-init-hook #'semantic-new-buffer-fcn)
    (remove-hook 'completion-at-point-functions
		 #'semantic-analyze-completion-at-point-function)
    (remove-hook 'completion-at-point-functions
		 #'semantic-analyze-notc-completion-at-point-function)
    (remove-hook 'completion-at-point-functions
		 #'semantic-analyze-nolongprefix-completion-at-point-function)

    (remove-hook 'after-change-functions
		 #'semantic-change-function)
    (define-key cedet-menu-map [cedet-menu-separator] nil)
    (define-key cedet-menu-map [semantic-options-separator] nil)
    ;; FIXME: handle semanticdb-load-ebrowse-caches
    (dolist (mode semantic-submode-list)
      (if (and (boundp mode) (symbol-value mode))
	  (funcall mode -1)))
    ;; Unlink buffer and clear cache
    (semantic--tag-unlink-cache-from-buffer)
    (setq semantic--buffer-cache nil)
    ;; Make sure we run the setup function if Semantic gets
    ;; re-activated.
    (setq semantic-new-buffer-fcn-was-run nil)))