Function: list-tags

list-tags is an autoloaded, interactive and byte-compiled function defined in etags.el.gz.

Signature

(list-tags FILE &optional NEXT-MATCH)

Documentation

Display list of tags in file FILE.

Interactively, prompt for FILE, with completion, offering the current buffer's file name as the default. This command searches only the first table in the list of tags tables, and does not search included tables. FILE should be as it was submitted to the etags command, which usually means relative to the directory of the tags table file.

View in manual

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/etags.el.gz
;;;###autoload
(defun list-tags (file &optional _next-match)
  "Display list of tags in file FILE.
Interactively, prompt for FILE, with completion, offering the current
buffer's file name as the default.
This command searches only the first table in the list of tags tables,
and does not search included tables.
FILE should be as it was submitted to the `etags' command, which usually
means relative to the directory of the tags table file."
  (interactive (list (completing-read
                      "List tags in file: "
                      'tags-complete-tags-table-file
                      nil t
                      ;; Default FILE to the current buffer's file.
                      (tags--get-current-buffer-name-in-tags-file))))
  (if (string-empty-p file)
      (user-error "You must specify a file name"))
  (with-output-to-temp-buffer "*Tags List*"
    (princ (substitute-command-keys "Tags in file `"))
    (tags-with-face 'highlight (princ file))
    (princ (substitute-command-keys "':\n\n"))
    (save-excursion
      (let ((first-time t)
	    (gotany nil)
            (cbuf (current-buffer)))
	(while (visit-tags-table-buffer (not first-time) cbuf)
	  (setq first-time nil)
	  (if (funcall list-tags-function file)
	      (setq gotany t)))
	(or gotany
	    (user-error "File %s not in current tags tables" file)))))
  (with-current-buffer "*Tags List*"
    (require 'apropos)
    (with-no-warnings
      (apropos-mode))
    (setq buffer-read-only t)))