Function: find-tag-other-window

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

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

Signature

(find-tag-other-window 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 in another window, 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 negative (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.

View in manual

Probably introduced at or before Emacs version 25.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/etags.el.gz
;;;###autoload
(defun find-tag-other-window (tagname &optional next-p regexp-p)
  "Find tag (in current tags table) whose name contains TAGNAME.
Select the buffer containing the tag's definition in another window, 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 negative (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-other-window "25.1"))
  (interactive (find-tag-interactive "Find tag other window"))

  ;; This hair is to deal with the case where the tag is found in the
  ;; selected window's buffer; without the hair, point is moved in both
  ;; windows.  To prevent this, we save the selected window's point before
  ;; doing find-tag-noselect, and restore it after.
  (let* ((window-point (window-point))
	 (tagbuf (find-tag-noselect tagname next-p regexp-p))
	 (tagpoint (progn (set-buffer tagbuf) (point))))
    (set-window-point (prog1
			  (selected-window)
			(switch-to-buffer-other-window tagbuf)
			;; We have to set this new window's point; it
			;; might already have been displaying a
			;; different portion of tagbuf, in which case
			;; switch-to-buffer-other-window doesn't set
			;; the window's point from the buffer.
			(set-window-point (selected-window) tagpoint))
		      window-point)))