aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoland McGrath1994-05-03 00:26:48 +0000
committerRoland McGrath1994-05-03 00:26:48 +0000
commitaab936ad6abe034ee0624186315449e234a2d32c (patch)
tree618ded5ab95dffdf9b45593ea8fe2eda320ea548
parent7e3cf34f8d5e888d0ff52a4345bcffc629dc591a (diff)
downloademacs-aab936ad6abe034ee0624186315449e234a2d32c.tar.gz
emacs-aab936ad6abe034ee0624186315449e234a2d32c.zip
(visit-tags-tbale-buffer): If CONT is stringp, use it for tags-file-name.
Don't bother calling tags-table-including when buffer-file-name is nil. (visit-tags-table): Signal error FILE is not stringp. Call visit-tags-table-buffer with FILE instead of 'same. (tags-next-table): When restoring state vars, set tags-file-name too.
-rw-r--r--lisp/progmodes/etags.el39
1 files changed, 25 insertions, 14 deletions
diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el
index 72d30c935b6..a3b51141168 100644
--- a/lisp/progmodes/etags.el
+++ b/lisp/progmodes/etags.el
@@ -184,12 +184,14 @@ file the tag was in."
184 default-directory) 184 default-directory)
185 t) 185 t)
186 current-prefix-arg)) 186 current-prefix-arg))
187 ;; Calling visit-tags-table-buffer with tags-file-name set to FILE will 187 (or (stringp file) (signal 'wrong-type-argument (list 'stringp file)))
188 ;; initialize a buffer for FILE and set tags-file-name to the 188 ;; Bind tags-file-name so we can control below whether the local or
189 ;; global value gets set. Calling visit-tags-table-buffer will
190 ;; initialize a buffer for the file and set tags-file-name to the
189 ;; fully-expanded name. 191 ;; fully-expanded name.
190 (let ((tags-file-name file)) 192 (let ((tags-file-name file))
191 (save-excursion 193 (save-excursion
192 (or (visit-tags-table-buffer 'same) 194 (or (visit-tags-table-buffer file)
193 (signal 'file-error (list "Visiting tags table" 195 (signal 'file-error (list "Visiting tags table"
194 "file does not exist" 196 "file does not exist"
195 file))) 197 file)))
@@ -237,6 +239,7 @@ file the tag was in."
237 ;; Restore the state variables. 239 ;; Restore the state variables.
238 (setq tags-table-list 240 (setq tags-table-list
239 (nth 0 (car tags-table-parent-pointer-list)) 241 (nth 0 (car tags-table-parent-pointer-list))
242 tags-file-name (car tags-table-list)
240 tags-table-list-pointer 243 tags-table-list-pointer
241 (nth 1 (car tags-table-parent-pointer-list)) 244 (nth 1 (car tags-table-parent-pointer-list))
242 tags-table-list-started-at 245 tags-table-list-started-at
@@ -411,6 +414,7 @@ file the tag was in."
411 414
412(defun visit-tags-table-buffer (&optional cont) 415(defun visit-tags-table-buffer (&optional cont)
413 "Select the buffer containing the current tags table. 416 "Select the buffer containing the current tags table.
417If optional arg is a string, visit that file as a tags table.
414If optional arg is t, visit the next table in `tags-table-list'. 418If optional arg is t, visit the next table in `tags-table-list'.
415If optional arg is the atom `same', don't look for a new table; 419If optional arg is the atom `same', don't look for a new table;
416 just select the buffer visiting `tags-file-name'. 420 just select the buffer visiting `tags-file-name'.
@@ -427,7 +431,7 @@ Returns t if it visits a tags table, or nil if there are no more in the list."
427 (concat "No tags table in use! " 431 (concat "No tags table in use! "
428 "Use \\[visit-tags-table] to select one."))))) 432 "Use \\[visit-tags-table] to select one.")))))
429 433
430 (visit-tags-table-buffer-cont 434 ((eq t visit-tags-table-buffer-cont)
431 ;; Find the next table. 435 ;; Find the next table.
432 (if (tags-next-table) 436 (if (tags-next-table)
433 ;; Skip over nonexistent files. 437 ;; Skip over nonexistent files.
@@ -451,6 +455,10 @@ Returns t if it visits a tags table, or nil if there are no more in the list."
451 ;; Pick a table out of our hat. 455 ;; Pick a table out of our hat.
452 (setq tags-file-name 456 (setq tags-file-name
453 (or 457 (or
458 ;; If passed a string, use that.
459 (if (stringp visit-tags-table-buffer-cont)
460 (prog1 visit-tags-table-buffer-cont
461 (setq visit-tags-table-buffer-cont nil)))
454 ;; First, try a local variable. 462 ;; First, try a local variable.
455 (cdr (assq 'tags-file-name (buffer-local-variables))) 463 (cdr (assq 'tags-file-name (buffer-local-variables)))
456 ;; Second, try a user-specified function to guess. 464 ;; Second, try a user-specified function to guess.
@@ -461,16 +469,19 @@ Returns t if it visits a tags table, or nil if there are no more in the list."
461 ;; If one is found, the lists will be frobnicated, 469 ;; If one is found, the lists will be frobnicated,
462 ;; and VISIT-TAGS-TABLE-BUFFER-CONT 470 ;; and VISIT-TAGS-TABLE-BUFFER-CONT
463 ;; will be set non-nil so we don't do it below. 471 ;; will be set non-nil so we don't do it below.
464 (car (or 472 (and buffer-file-name
465 ;; First check only tables already in buffers. 473 (car (or
466 (save-excursion (tags-table-including buffer-file-name 474 ;; First check only tables already in buffers.
467 tags-table-list 475 (save-excursion
468 t)) 476 (tags-table-including buffer-file-name
469 ;; Since that didn't find any, now do the 477 tags-table-list
470 ;; expensive version: reading new files. 478 t))
471 (save-excursion (tags-table-including buffer-file-name 479 ;; Since that didn't find any, now do the
472 tags-table-list 480 ;; expensive version: reading new files.
473 nil)))) 481 (save-excursion
482 (tags-table-including buffer-file-name
483 tags-table-list
484 nil)))))
474 ;; Fourth, use the user variable tags-file-name, if it is 485 ;; Fourth, use the user variable tags-file-name, if it is
475 ;; not already in tags-table-list. 486 ;; not already in tags-table-list.
476 (and tags-file-name 487 (and tags-file-name