(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))