Function: semanticdb-kill-hook
semanticdb-kill-hook is a byte-compiled function defined in
db-mode.el.gz.
Signature
(semanticdb-kill-hook)
Documentation
Function run when a buffer is killed.
If there is a semantic cache, slurp out the overlays, and store it in our database. If that buffer has no cache, ignore it, we'll handle it later if need be.
Source Code
;; Defined in /usr/src/emacs/lisp/cedet/semantic/db-mode.el.gz
(defun semanticdb-kill-hook ()
"Function run when a buffer is killed.
If there is a semantic cache, slurp out the overlays, and store
it in our database. If that buffer has no cache, ignore it, we'll
handle it later if need be."
(when (and (semantic-active-p)
semantic--buffer-cache
semanticdb-current-table)
;; Try to get a fast update.
(semantic-fetch-tags-fast)
;; If the buffer is in a bad state, don't save anything...
(if (semantic-parse-tree-needs-rebuild-p)
;; If this is the case, don't save anything.
(progn
(semantic-clear-toplevel-cache)
(oset semanticdb-current-table pointmax 0)
(oset semanticdb-current-table fsize 0)
(oset semanticdb-current-table lastmodtime nil)
)
;; We have a clean buffer, save it off.
(condition-case nil
(progn
(semantic--tag-unlink-cache-from-buffer)
;; Set pointmax only if we had some success in the unlink.
(oset semanticdb-current-table pointmax (point-max))
(let ((fattr (file-attributes
(semanticdb-full-filename
semanticdb-current-table))))
(oset semanticdb-current-table fsize (file-attribute-size fattr))
(oset semanticdb-current-table lastmodtime
(file-attribute-modification-time fattr))
(oset semanticdb-current-table buffer nil)
))
;; If this messes up, just clear the system
(error
(semantic-clear-toplevel-cache)
(message "semanticdb: Failed to deoverlay tag cache.")))
)
))