branch: externals/consult commit 634d006297354b5e27b8554c7c616574ce55211d Author: Daniel Mendler <m...@daniel-mendler.de> Commit: Daniel Mendler <m...@daniel-mendler.de>
consult-xref: Add preview support for xref-etags-location (Fix #606) --- consult-xref.el | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/consult-xref.el b/consult-xref.el index 8405abac34..2fb8883ce9 100644 --- a/consult-xref.el +++ b/consult-xref.el @@ -62,18 +62,20 @@ (when-let (loc (and cand (eq action 'preview) (xref-item-location cand))) ;; Only preview file and buffer markers - (cl-typecase loc - (xref-buffer-location + (pcase (type-of loc) + ('xref-buffer-location (xref-location-marker loc)) - (xref-file-location + ((and type (or 'xref-file-location 'xref-etags-location)) (consult--position-marker (funcall open ;; xref-location-group returns the file name (let ((xref-file-name-display 'abs)) (xref-location-group loc))) (xref-location-line loc) - (xref-file-location-column loc))) - (t (message "No preview for %s" (type-of loc)) nil)))))))) + (if (eq type 'xref-file-location) + (xref-file-location-column loc) + 0))) + (_ (message "No preview for %s" (type-of loc)) nil)))))))) (defun consult-xref--group (cand transform) "Return title for CAND or TRANSFORM the candidate."