Function: semantic-dependency-tag-file
semantic-dependency-tag-file is an autoloaded and byte-compiled
function defined in tag-file.el.gz.
Signature
(semantic-dependency-tag-file &optional TAG)
Documentation
Find the filename represented from TAG.
Depends on semantic-dependency-include-path for searching. Always searches
. first, then searches additional paths.
Source Code
;; Defined in /usr/src/emacs/lisp/cedet/semantic/tag-file.el.gz
;;; Dependencies
;;
;; A tag which is of type 'include specifies a dependency.
;; Dependencies usually represent a file of some sort.
;; Find the file described by a dependency.
;;;###autoload
(define-overloadable-function semantic-dependency-tag-file (&optional tag)
"Find the filename represented from TAG.
Depends on `semantic-dependency-include-path' for searching. Always searches
`.' first, then searches additional paths."
(or tag (setq tag (car (semantic-find-tag-by-overlay nil))))
(unless (semantic-tag-of-class-p tag 'include)
(signal 'wrong-type-argument (list tag 'include)))
(save-excursion
(let ((result nil)
(default-directory default-directory)
(edefind nil)
(tag-fname nil))
(cond ((semantic-tag-in-buffer-p tag)
;; If the tag has an overlay and buffer associated with it,
;; switch to that buffer so that we get the right override methods.
(set-buffer (semantic-tag-buffer tag)))
((semantic-tag-file-name tag)
;; If it didn't have a buffer, but does have a file
;; name, then we need to get to that file so the tag
;; location is made accurate.
;;(set-buffer (find-file-noselect (semantic-tag-file-name tag)))
;;
;; 2/3/08
;; The above causes unnecessary buffer loads all over the place. Ick!
;; All we really need is for 'default-directory' to be set correctly.
(setq default-directory (file-name-directory (semantic-tag-file-name tag)))
))
;; Setup the filename represented by this include
(setq tag-fname (semantic-tag-include-filename tag))
;; First, see if this file exists in the current EDE project
(if (and (fboundp 'ede-expand-filename) ede-minor-mode
(setq edefind
(condition-case nil
(let ((proj (ede-toplevel)))
(when proj
(ede-expand-filename proj tag-fname)))
(error nil))))
(setq result edefind))
(if (not result)
(setq result
;; I don't have a plan for refreshing tags with a dependency
;; stuck on them somehow. I'm thinking that putting a cache
;; onto the dependency finding with a hash table might be best.
;;(if (semantic--tag-get-property tag 'dependency-file)
;; (semantic--tag-get-property tag 'dependency-file)
(:override
(save-excursion
(require 'semantic/dep)
(semantic-dependency-find-file-on-path
tag-fname (semantic-tag-include-system-p tag))))
;; )
))
(if (stringp result)
(progn
(semantic--tag-put-property tag 'dependency-file result)
result)
;; @todo: Do something to make this get flushed w/
;; when the path is changed.
;; @undo: Just eliminate
;; (semantic--tag-put-property tag 'dependency-file 'none)
nil)
)))