Function: find-tag

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

This command is obsolete since 25.1; use xref-find-definitions instead.

Signature

(find-tag TAGNAME &optional NEXT-P REGEXP-P)

Documentation

Find tag (in current tags table) whose name contains TAGNAME.

Select the buffer containing the tag's definition, and move point there. The default for TAGNAME is the expression in the buffer around or before point.

If second arg NEXT-P is t (interactively, with prefix arg), search for another tag that matches the last tagname or regexp used. When there are multiple matches for a tag, more exact matches are found first. If NEXT-P is the atom - (interactively, with prefix arg that is a negative number or just M-- (negative-argument)), pop back to the previous tag gone to.

If third arg REGEXP-P is non-nil, treat TAGNAME as a regexp.

A marker representing the point when this command is invoked is pushed onto a ring and may be popped back to with M-x pop-tag-mark (pop-tag-mark). Contrast this with the ring of marks gone to by the command.

See documentation of variable tags-file-name.

Probably introduced at or before Emacs version 19.20.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/etags.el.gz
;;;###autoload
(defun find-tag (tagname &optional next-p regexp-p)
  "Find tag (in current tags table) whose name contains TAGNAME.
Select the buffer containing the tag's definition, and move point there.
The default for TAGNAME is the expression in the buffer around or before point.

If second arg NEXT-P is t (interactively, with prefix arg), search for
another tag that matches the last tagname or regexp used.  When there are
multiple matches for a tag, more exact matches are found first.  If NEXT-P
is the atom `-' (interactively, with prefix arg that is a negative number
or just \\[negative-argument]), pop back to the previous tag gone to.

If third arg REGEXP-P is non-nil, treat TAGNAME as a regexp.

A marker representing the point when this command is invoked is pushed
onto a ring and may be popped back to with \\[pop-tag-mark].
Contrast this with the ring of marks gone to by the command.

See documentation of variable `tags-file-name'."
  (declare (obsolete xref-find-definitions "25.1"))
  (interactive (find-tag-interactive "Find tag"))
  (let* ((buf (find-tag-noselect tagname next-p regexp-p))
	 (pos (with-current-buffer buf (point))))
    (condition-case nil
	(switch-to-buffer buf)
      (error (pop-to-buffer buf)))
    (goto-char pos)))