changeset 7287:0e89007c19c6

(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.
author Roland McGrath <roland@gnu.org>
date Tue, 03 May 1994 00:26:48 +0000
parents 15bf025e8f8c
children a53bf0d79146
files lisp/progmodes/etags.el
diffstat 1 files changed, 25 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/progmodes/etags.el	Mon May 02 23:53:03 1994 +0000
+++ b/lisp/progmodes/etags.el	Tue May 03 00:26:48 1994 +0000
@@ -184,12 +184,14 @@
 						       default-directory)
 				     t)
 		     current-prefix-arg))
-  ;; Calling visit-tags-table-buffer with tags-file-name set to FILE will
-  ;; initialize a buffer for FILE and set tags-file-name to the
+  (or (stringp file) (signal 'wrong-type-argument (list 'stringp file)))
+  ;; Bind tags-file-name so we can control below whether the local or
+  ;; global value gets set.  Calling visit-tags-table-buffer will
+  ;; initialize a buffer for the file and set tags-file-name to the
   ;; fully-expanded name.
   (let ((tags-file-name file))
     (save-excursion
-      (or (visit-tags-table-buffer 'same)
+      (or (visit-tags-table-buffer file)
 	  (signal 'file-error (list "Visiting tags table"
 				    "file does not exist"
 				    file)))
@@ -237,6 +239,7 @@
 	      ;; Restore the state variables.
 	      (setq tags-table-list
 		    (nth 0 (car tags-table-parent-pointer-list))
+		    tags-file-name (car tags-table-list)
 		    tags-table-list-pointer
 		    (nth 1 (car tags-table-parent-pointer-list))
 		    tags-table-list-started-at
@@ -411,6 +414,7 @@
 
 (defun visit-tags-table-buffer (&optional cont)
   "Select the buffer containing the current tags table.
+If optional arg is a string, visit that file as a tags table.
 If optional arg is t, visit the next table in `tags-table-list'.
 If optional arg is the atom `same', don't look for a new table;
  just select the buffer visiting `tags-file-name'.
@@ -427,7 +431,7 @@
 		       (concat "No tags table in use!  "
 			       "Use \\[visit-tags-table] to select one.")))))
 
-	  (visit-tags-table-buffer-cont
+	  ((eq t visit-tags-table-buffer-cont)
 	   ;; Find the next table.
 	   (if (tags-next-table)
 	       ;; Skip over nonexistent files.
@@ -451,6 +455,10 @@
 	   ;; Pick a table out of our hat.
 	   (setq tags-file-name
 		 (or
+		  ;; If passed a string, use that.
+		  (if (stringp visit-tags-table-buffer-cont)
+		      (prog1 visit-tags-table-buffer-cont
+			(setq visit-tags-table-buffer-cont nil)))
 		  ;; First, try a local variable.
 		  (cdr (assq 'tags-file-name (buffer-local-variables)))
 		  ;; Second, try a user-specified function to guess.
@@ -461,16 +469,19 @@
 		  ;; If one is found, the lists will be frobnicated,
 		  ;; and VISIT-TAGS-TABLE-BUFFER-CONT
 		  ;; will be set non-nil so we don't do it below.
-		  (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))))
+		  (and buffer-file-name
+		       (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