Function: tags-verify-table

tags-verify-table is a byte-compiled function defined in etags.el.gz.

Signature

(tags-verify-table FILE)

Documentation

Read FILE into a buffer and verify that it is a valid tags table.

Sets the current buffer to one visiting FILE (if it exists). Returns non-nil if it is a valid table.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/etags.el.gz
(defun tags-verify-table (file)
  "Read FILE into a buffer and verify that it is a valid tags table.
Sets the current buffer to one visiting FILE (if it exists).
Returns non-nil if it is a valid table."
  (if (get-file-buffer file)
      ;; The file is already in a buffer.  Check for the visited file
      ;; having changed since we last used it.
      (progn
	(set-buffer (get-file-buffer file))
        (or verify-tags-table-function (tags-table-mode))
	(unless (or (verify-visited-file-modtime (current-buffer))
                    ;; 'verify-visited-file-modtime' return non-nil if
                    ;; the tags table file was meanwhile deleted.  Avoid
                    ;; asking the question below again if so.
                    (not (file-exists-p file))
		    ;; Decide whether to revert the file.
		    ;; revert-without-query can say to revert
		    ;; or the user can say to revert.
		    (not (or (let ((tail revert-without-query)
                                   (found nil))
			       (while tail
                                 (if (string-match (car tail) buffer-file-name)
				     (setq found t))
                                 (setq tail (cdr tail)))
			       found)
			     tags-revert-without-query
			     (yes-or-no-p
			      (format "Tags file %s has changed, read new contents? "
				      file)))))
	  (revert-buffer t t)
	  (tags-table-mode))
        (and verify-tags-table-function
	     (funcall verify-tags-table-function)))
    (when (file-exists-p file)
      (let* ((buf (find-file-noselect file))
             (newfile (buffer-file-name buf)))
        (unless (string= file newfile)
          ;; find-file-noselect has changed the file name.
          ;; Propagate the change to tags-file-name and tags-table-list.
          (let ((tail (member file tags-table-list)))
            (if tail (setcar tail newfile)))
          (if (eq file tags-file-name) (setq tags-file-name newfile)))
        ;; Only change buffer now that we're done using potentially
        ;; buffer-local variables.
        (set-buffer buf)
        (tags-table-mode)
        (and verify-tags-table-function
	     (funcall verify-tags-table-function))))))