Mercurial > emacs
comparison lisp/progmodes/etags.el @ 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 | 9dace03bd76c |
children | 54b82ecde27b |
comparison
equal
deleted
inserted
replaced
2767:482fa0725db6 | 2768:82797c755adc |
---|---|
258 (not (string= file (tags-expand-table-name (car list))))) | 258 (not (string= file (tags-expand-table-name (car list))))) |
259 (setq list (cdr list))) | 259 (setq list (cdr list))) |
260 list) | 260 list) |
261 | 261 |
262 ;; Subroutine of visit-tags-table-buffer. Frobs its local vars. | 262 ;; Subroutine of visit-tags-table-buffer. Frobs its local vars. |
263 ;; Search TABLES for one that has tags for THIS-FILE. Recurses | 263 ;; Search TABLES for one that has tags for THIS-FILE. Recurses on |
264 ;; on included tables. Returns the tail of TABLES (or of an | 264 ;; included tables. Returns the tail of TABLES (or of an inner |
265 ;; inner included list) whose car is a table listing THIS-FILE. | 265 ;; included list) whose car is a table listing THIS-FILE. If |
266 (defun tags-table-including (this-file tables &optional recursing) | 266 ;; CORE-ONLY is non-nil, check only tags tables that are already in |
267 ;; buffers--don't visit any new files. | |
268 (defun tags-table-including (this-file tables core-only &optional recursing) | |
267 (let ((found nil)) | 269 (let ((found nil)) |
268 ;; Loop over TABLES, looking for one containing tags for THIS-FILE. | 270 ;; Loop over TABLES, looking for one containing tags for THIS-FILE. |
269 (while (and (not found) | 271 (while (and (not found) |
270 tables) | 272 tables) |
271 (let ((tags-file-name (tags-expand-table-name (car tables)))) | 273 (let ((tags-file-name (tags-expand-table-name (car tables)))) |
272 (if (or (get-file-buffer tags-file-name) | 274 (if (or (get-file-buffer tags-file-name) |
273 (file-exists-p tags-file-name)) ;XXX check all in core first. | 275 (and (not core-only) |
276 (file-exists-p tags-file-name))) | |
274 (progn | 277 (progn |
275 ;; Select the tags table buffer and get the file list up to date. | 278 ;; Select the tags table buffer and get the file list up to date. |
276 (visit-tags-table-buffer 'same) | 279 (visit-tags-table-buffer 'same) |
277 (or tags-table-files | 280 (or tags-table-files |
278 (setq tags-table-files | 281 (setq tags-table-files |
294 (setq tags-table-parent-pointer-list nil)) | 297 (setq tags-table-parent-pointer-list nil)) |
295 (setq found | 298 (setq found |
296 ;; Recurse on the list of included tables. | 299 ;; Recurse on the list of included tables. |
297 (tags-table-including this-file | 300 (tags-table-including this-file |
298 tags-included-tables | 301 tags-included-tables |
302 core-only | |
299 t)) | 303 t)) |
300 (if found | 304 (if found |
301 ;; One of them lists THIS-FILE. | 305 ;; One of them lists THIS-FILE. |
302 ;; Set the table list state variables to move | 306 ;; Set the table list state variables to move |
303 ;; us inside the list of included tables. | 307 ;; us inside the list of included tables. |
369 (funcall default-tags-table-function)) | 373 (funcall default-tags-table-function)) |
370 ;; Third, look for a tags table that contains | 374 ;; Third, look for a tags table that contains |
371 ;; tags for the current buffer's file. | 375 ;; tags for the current buffer's file. |
372 ;; If one is found, the lists will be frobnicated, | 376 ;; If one is found, the lists will be frobnicated, |
373 ;; and CONT will be set non-nil so we don't do it below. | 377 ;; and CONT will be set non-nil so we don't do it below. |
374 (car (save-excursion (tags-table-including buffer-file-name | 378 (car (or |
375 tags-table-list))) | 379 ;; First check only tables already in buffers. |
380 (save-excursion (tags-table-including buffer-file-name | |
381 tags-table-list | |
382 t)) | |
383 ;; Since that didn't find any, now do the | |
384 ;; expensive version: reading new files. | |
385 (save-excursion (tags-table-including buffer-file-name | |
386 tags-table-list | |
387 nil)))) | |
376 ;; Fourth, use the user variable tags-file-name, if it is not | 388 ;; Fourth, use the user variable tags-file-name, if it is not |
377 ;; already in tags-table-list. | 389 ;; already in tags-table-list. |
378 (and tags-file-name | 390 (and tags-file-name |
379 (not (tags-table-list-member tags-file-name)) | 391 (not (tags-table-list-member tags-file-name)) |
380 tags-file-name) | 392 tags-file-name) |