Function: semanticdb-semantic-init-hook-fcn
semanticdb-semantic-init-hook-fcn is a byte-compiled function defined
in db-mode.el.gz.
Signature
(semanticdb-semantic-init-hook-fcn)
Documentation
Function saved in semantic-init-db-hook.
Sets up the semanticdb environment.
Source Code
;; Defined in /usr/src/emacs/lisp/cedet/semantic/db-mode.el.gz
;;; Hook Functions:
;;
;; Functions used in hooks to keep SemanticDB operating.
;;
(defun semanticdb-semantic-init-hook-fcn ()
"Function saved in `semantic-init-db-hook'.
Sets up the semanticdb environment."
;; Only initialize semanticdb if we have a file name.
;; There is no reason to cache a tag table if there is no
;; way to load it back in later.
(when (buffer-file-name)
(let* ((ans (semanticdb-create-table-for-file (buffer-file-name)))
(cdb (car ans))
(ctbl (cdr ans))
)
;; Get the current DB for this directory
(setq semanticdb-current-database cdb)
;; We set the major mode because we know what it is.
(oset ctbl major-mode major-mode)
;; Local state
(setq semanticdb-current-table ctbl)
(oset ctbl buffer (current-buffer))
;; Try to swap in saved tags
(if (or (not (slot-boundp ctbl 'tags)) (not (oref ctbl tags))
(/= (or (oref ctbl pointmax) 0) (point-max))
)
(semantic-clear-toplevel-cache)
;; Unmatched syntax
(condition-case nil
(semantic-set-unmatched-syntax-cache
(oref ctbl unmatched-syntax))
(unbound-slot
;; Old version of the semanticdb table can miss the unmatched
;; syntax slot. If so, just clear the unmatched syntax cache.
(semantic-clear-unmatched-syntax-cache)
;; Make sure it has a value.
(oset ctbl unmatched-syntax nil)
))
;; Keep lexical tables up to date. Don't load
;; semantic-spp if it isn't needed.
(let ((lt (oref ctbl lexical-table)))
(when lt
(require 'semantic/lex-spp)
(semantic-lex-spp-set-dynamic-table lt)))
;; Set the main tag cache.
;; This must happen after setting up buffer local variables
;; since this will turn around and re-save those variables.
(semantic--set-buffer-cache (oref ctbl tags))
;; Don't need it to be dirty. Set dirty due to hooks from above.
(oset ctbl dirty nil) ;; Special case here.
;; Bind into the buffer.
(semantic--tag-link-cache-to-buffer)
)
)))