From 5c9e49a953e19c82eea23b88549ffb394a02af33 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Thu, 20 Oct 1994 21:17:44 +0000 Subject: [PATCH] (next-file): Initialize next-file-list all at once from all tables. Never call visit-tags-table-buffer when INITIALIZE is not t. --- lisp/progmodes/etags.el | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el index 42c43ee1f01..2cab15afec2 100644 --- a/lisp/progmodes/etags.el +++ b/lisp/progmodes/etags.el @@ -1231,22 +1231,28 @@ if the file was newly read in, the value is the filename." (save-excursion ;; Visit the tags table buffer to get its list of files. (visit-tags-table-buffer) - (setq next-file-list (tags-table-files)))) + ;; Copy the list so we can setcdr below. + (setq next-file-list (copy-sequence (tags-table-files))) + ;; Iterate over all the tags table files, collecting + ;; a complete list of referenced file names. + (while (visit-tags-table-buffer t) + ;; Find the tail of the working list and chain on the new + ;; sublist for this tags table. + (let ((tail next-file-list)) + (while (cdr tail) + (setq tail (cdr tail))) + ;; Use a copy so the next loop iteration will not modify the + ;; list later returned by (tags-table-files). + (setcdr tail (copy-sequence (tags-table-files))))))) (t ;; Initialize the list by evalling the argument. (setq next-file-list (eval initialize)))) - (or next-file-list - (save-excursion - ;; Get the files from the next tags table. - ;; When doing (visit-tags-table-buffer t), - ;; the tags table buffer must be current. - (if (and (visit-tags-table-buffer 'same) - (visit-tags-table-buffer t)) - (setq next-file-list (tags-table-files)) - (and novisit - (get-buffer " *next-file*") - (kill-buffer " *next-file*")) - (error "All files processed.")))) + (if next-file-list + () + (and novisit + (get-buffer " *next-file*") + (kill-buffer " *next-file*")) + (error "All files processed.")) (let ((new (not (get-file-buffer (car next-file-list))))) (if (not (and new novisit)) (set-buffer (find-file-noselect (car next-file-list) novisit)) -- 2.39.5