Function: treemacs-find-tag
treemacs-find-tag is an autoloaded, interactive and byte-compiled
function defined in treemacs.el.
Signature
(treemacs-find-tag)
Documentation
Find and move point to the tag at point in the treemacs view.
Most likely to be useful when treemacs-tag-follow-mode(var)/treemacs-tag-follow-mode(fun) is not active.
Will ask to change the treemacs root if the file to find is not under the root. If no treemacs buffer exists it will be created with the current file's containing directory as root. Will do nothing if the current buffer is not visiting a file or Emacs cannot find any tags for the current file.
Key Bindings
Source Code
;; Defined in ~/.emacs.d/elpa/treemacs-20251226.1307/treemacs.el
;;;###autoload
(defun treemacs-find-tag ()
"Find and move point to the tag at point in the treemacs view.
Most likely to be useful when `treemacs-tag-follow-mode' is not active.
Will ask to change the treemacs root if the file to find is not under the
root. If no treemacs buffer exists it will be created with the current file's
containing directory as root. Will do nothing if the current buffer is not
visiting a file or Emacs cannot find any tags for the current file."
(interactive)
(treemacs-block
(let* ((buffer (current-buffer))
(buffer-file (when buffer (buffer-file-name buffer)))
(project (treemacs--find-project-for-buffer))
(index (when buffer-file (treemacs--flatten&sort-imenu-index)))
(treemacs-window nil))
(treemacs-error-return-if (null buffer-file)
"Current buffer is not visiting a file.")
(treemacs-error-return-if (null index)
"Current buffer has no tags.")
(treemacs-error-return-if (eq index 'unsupported)
"Treemacs does not support following tags in this major mode.")
(treemacs-error-return-if (null project)
"%s does not fall under any project in the workspace."
(propertize buffer-file 'face 'font-lock-string-face))
(save-selected-window
(pcase (treemacs-current-visibility)
('visible (treemacs--select-visible-window))
('exists (treemacs--select-not-visible-window))
('none (treemacs--init)))
(setq treemacs-window (selected-window)))
(treemacs--do-follow-tag index treemacs-window buffer-file project))))