changeset 2768:82797c755adc

(tags-table-including): Take new third arg CORE-ONLY. If non-nil, ignore files without extant buffers. (visit-tags-table-buffer): Call tags-table-including first with CORE-ONLY set, and then afterwards with it clear.
author Roland McGrath <roland@gnu.org>
date Thu, 13 May 1993 05:28:14 +0000
parents 482fa0725db6
children 209f745babd1
files lisp/progmodes/etags.el
diffstat 1 files changed, 19 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/progmodes/etags.el	Thu May 13 04:08:52 1993 +0000
+++ b/lisp/progmodes/etags.el	Thu May 13 05:28:14 1993 +0000
@@ -260,17 +260,20 @@
   list)
 
 ;; Subroutine of visit-tags-table-buffer.  Frobs its local vars.
-;; Search TABLES for one that has tags for THIS-FILE.  Recurses
-;; on included tables.  Returns the tail of TABLES (or of an
-;; inner included list) whose car is a table listing THIS-FILE.
-(defun tags-table-including (this-file tables &optional recursing)
+;; Search TABLES for one that has tags for THIS-FILE.  Recurses on
+;; included tables.  Returns the tail of TABLES (or of an inner
+;; included list) whose car is a table listing THIS-FILE.  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 tables core-only &optional recursing)
   (let ((found nil))
     ;; Loop over TABLES, looking for one containing tags for THIS-FILE.
     (while (and (not found)
 		tables)
       (let ((tags-file-name (tags-expand-table-name (car tables))))
 	(if (or (get-file-buffer tags-file-name)
-		(file-exists-p tags-file-name))	;XXX check all in core first.
+		(and (not core-only)
+		     (file-exists-p tags-file-name)))
 	    (progn
 	      ;; Select the tags table buffer and get the file list up to date.
 	      (visit-tags-table-buffer 'same)
@@ -296,6 +299,7 @@
 				   ;; Recurse on the list of included tables.
 				   (tags-table-including this-file
 							 tags-included-tables
+							 core-only
 							 t))
 			     (if found
 				 ;; One of them lists THIS-FILE.
@@ -371,8 +375,16 @@
 		;; tags for the current buffer's file.
 		;; If one is found, the lists will be frobnicated,
 		;; and CONT will be set non-nil so we don't do it below.
-		(car (save-excursion (tags-table-including buffer-file-name
-							   tags-table-list)))
+		(car (or 
+		      ;; First check only tables already in buffers.
+		      (save-excursion (tags-table-including buffer-file-name
+							       tags-table-list
+							       t))
+		      ;; Since that didn't find any, now do the
+		      ;; expensive version: reading new files.
+		      (save-excursion (tags-table-including buffer-file-name
+							    tags-table-list
+							    nil))))
 		;; Fourth, use the user variable tags-file-name, if it is not
 		;; already in tags-table-list.
 		(and tags-file-name