Function: treemacs--tag-noselect
treemacs--tag-noselect is a byte-compiled function defined in
treemacs-mouse-interface.el.
Signature
(treemacs--tag-noselect BTN)
Documentation
Return list of tag source buffer and position for BTN for future display.
Source Code
;; Defined in ~/.emacs.d/elpa/treemacs-20251226.1307/treemacs-mouse-interface.el
(defun treemacs--tag-noselect (btn)
"Return list of tag source buffer and position for BTN for future display."
(cl-flet ((xref-definition
(identifier)
"Return the first definition of string IDENTIFIER."
(car (xref-backend-definitions (xref-find-backend) identifier)))
(xref-item-buffer
(item)
"Return the buffer in which xref ITEM is defined."
(marker-buffer (save-excursion (xref-location-marker (xref-item-location item)))))
(xref-item-position
(item)
"Return the buffer position where xref ITEM is defined."
(marker-position (save-excursion (xref-location-marker (xref-item-location item))))))
(-let [(tag-buf . tag-pos)
(treemacs-with-button-buffer btn
(let ((marker (treemacs-button-get :marker btn))
(path (treemacs-button-get :path btn)))
(treemacs--extract-position marker path)))]
(if tag-buf
(list tag-buf tag-pos)
(pcase treemacs-goto-tag-strategy
('refetch-index
(let (file tag-path)
(with-current-buffer (marker-buffer btn)
(setq file (treemacs--nearest-path btn)
tag-path (treemacs-button-get btn :path)))
(treemacs--imenu-tag-noselect file tag-path)))
('call-xref
(let ((xref (xref-definition
(treemacs-with-button-buffer btn
(treemacs--get-label-of btn)))))
(when xref
(list (xref-item-buffer xref) (xref-item-position xref)))))
('issue-warning
(treemacs-log-failure "Tag '%s' is located in a buffer that does not exist."
(propertize (treemacs-with-button-buffer btn (treemacs--get-label-of btn)) 'face 'treemacs-tags-face)))
(_ (error "[Treemacs] '%s' is an invalid value for treemacs-goto-tag-strategy" treemacs-goto-tag-strategy)))))))