Function: semantic-new-buffer-fcn

semantic-new-buffer-fcn is a byte-compiled function defined in semantic.el.gz.

Signature

(semantic-new-buffer-fcn)

Documentation

Setup the current buffer to use Semantic.

If the major mode is ready for Semantic, and no semantic-inhibit-functions disabled it, the current buffer is setup to use Semantic, and semantic-init-hook is run.

Source Code

;; Defined in /usr/src/emacs/lisp/cedet/semantic.el.gz
(defun semantic-new-buffer-fcn ()
  "Setup the current buffer to use Semantic.
If the major mode is ready for Semantic, and no
`semantic-inhibit-functions' disabled it, the current buffer is setup
to use Semantic, and `semantic-init-hook' is run."
  ;; In upstream Semantic, the parser setup functions are called from
  ;; mode hooks.  In the version bundled with Emacs, we do it here.
  (let ((entry (cl-assoc-if #'derived-mode-p semantic-new-buffer-setup-functions)))
    (when entry
      (funcall (cdr entry))))
  ;; Do stuff if semantic was activated by a mode hook in this buffer,
  ;; and not afterwards disabled.
  (when (and semantic--parse-table
             (not (semantic-active-p))
             (not (run-hook-with-args-until-success
                   'semantic-inhibit-functions)))
    ;; Make sure that if this buffer is cloned, our tags and overlays
    ;; don't go along for the ride.
    (add-hook 'clone-indirect-buffer-hook #'semantic-clear-toplevel-cache
	      nil t)
    ;; Specify that this function has done its work.  At this point
    ;; we can consider that semantic is active in this buffer.
    (setq semantic-new-buffer-fcn-was-run t)
    ;; Here are some buffer local variables we can initialize ourselves
    ;; of a mode does not choose to do so.
    (semantic-lex-init)
    ;; Force this buffer to have its cache refreshed.
    (semantic-clear-toplevel-cache)
    ;; Call DB hooks before regular init hooks
    (run-hooks 'semantic-init-db-hook)
    ;; Set up semantic modes
    (run-hooks 'semantic-init-hook)
    ;; Set up major-mode specific semantic modes
    (run-hooks 'semantic-init-mode-hook)))