Function: tag-find-file-of-tag-noselect
tag-find-file-of-tag-noselect is a byte-compiled function defined in
etags.el.gz.
Signature
(tag-find-file-of-tag-noselect FILE)
Documentation
Find the right line in the specified FILE.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/etags.el.gz
(defun tag-find-file-of-tag-noselect (file)
"Find the right line in the specified FILE."
;; If interested in compressed-files, search files with extensions.
;; Otherwise, search only the real file.
(let* ((buffer-search-extensions (if auto-compression-mode
tags-compression-info-list
'("")))
the-buffer
(file-search-extensions buffer-search-extensions))
;; search a buffer visiting the file with each possible extension
;; Note: there is a small inefficiency in find-buffer-visiting :
;; truename is computed even if not needed. Not too sure about this
;; but I suspect truename computation accesses the disk.
;; It is maybe a good idea to optimize this find-buffer-visiting.
;; An alternative would be to use only get-file-buffer
;; but this looks less "sure" to find the buffer for the file.
(while (and (not the-buffer) buffer-search-extensions)
(setq the-buffer (find-buffer-visiting (concat file (car buffer-search-extensions))))
(setq buffer-search-extensions (cdr buffer-search-extensions)))
;; if found a buffer but file modified, ensure we re-read !
(if (and the-buffer (not (verify-visited-file-modtime the-buffer)))
(find-file-noselect (buffer-file-name the-buffer)))
;; if no buffer found, search for files with possible extensions on disk
(while (and (not the-buffer) file-search-extensions)
(if (not (file-exists-p (concat file (car file-search-extensions))))
(setq file-search-extensions (cdr file-search-extensions))
(setq the-buffer (find-file-noselect (concat file (car file-search-extensions))))))
(if (not the-buffer)
(if auto-compression-mode
(error "File %s (with or without extensions %s) not found" file tags-compression-info-list)
(error "File %s not found" file))
(set-buffer the-buffer))))