Function: tags-table-including
tags-table-including is a byte-compiled function defined in
etags.el.gz.
Signature
(tags-table-including THIS-FILE CORE-ONLY)
Documentation
Search current tags tables for tags for THIS-FILE.
Subroutine of visit-tags-table-buffer.
Looks for a tags table that has such tags or that includes a table
that has them. Returns the name of the first such table.
Non-nil CORE-ONLY means check only tags tables that are already in
buffers. If CORE-ONLY is nil, it is ignored.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/etags.el.gz
;; Subroutine of visit-tags-table-buffer. Search the current tags tables
;; for one that has tags for THIS-FILE (or that includes a table that
;; does). Return the name of the first table listing THIS-FILE; if
;; the table is one included by another table, it is the master table that
;; we return. If CORE-ONLY is non-nil, check only tags tables that are
;; already in buffers--don't visit any new files.
(defun tags-table-including (this-file core-only)
"Search current tags tables for tags for THIS-FILE.
Subroutine of `visit-tags-table-buffer'.
Looks for a tags table that has such tags or that includes a table
that has them. Returns the name of the first such table.
Non-nil CORE-ONLY means check only tags tables that are already in
buffers. If CORE-ONLY is nil, it is ignored."
(let ((tables tags-table-computed-list)
(found nil))
;; Loop over the list, looking for a table containing tags for THIS-FILE.
(while (and (not found)
tables)
(if core-only
;; Skip tables not in core.
(while (eq (nth 1 tables) t)
(setq tables (cdr (cdr tables))))
(if (eq (nth 1 tables) t)
;; This table has not been read into core yet. Read it in now.
(tags-table-extend-computed-list)))
(if tables
;; Select the tags table buffer and get the file list up to date.
(let ((tags-file-name (car tables)))
(visit-tags-table-buffer 'same)
(if (member this-file (mapcar #'expand-file-name
(tags-table-files)))
;; Found it.
(setq found tables))))
(setq tables (cdr tables)))
(if found
;; Now determine if the table we found was one included by another
;; table, not explicitly listed. We do this by checking each
;; element of the computed list to see if it appears in the user's
;; explicit list; the last element we will check is FOUND itself.
;; Then we return the last one which did in fact appear in
;; tags-table-list.
(let ((could-be nil)
(elt tags-table-computed-list))
(while (not (eq elt (cdr found)))
(if (tags-table-list-member (car elt) tags-table-list)
;; This table appears in the user's list, so it could be
;; the one which includes the table we found.
(setq could-be (car elt)))
(setq elt (cdr elt))
(if (eq t (car elt))
(setq elt (cdr elt))))
;; The last element we found in the computed list before FOUND
;; that appears in the user's list will be the table that
;; included the one we found.
could-be))))