[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/consult 1680f26f1c 2/2: consult-xref--preview: Simplify
From: |
ELPA Syncer |
Subject: |
[elpa] externals/consult 1680f26f1c 2/2: consult-xref--preview: Simplify |
Date: |
Mon, 11 Jul 2022 10:57:26 -0400 (EDT) |
branch: externals/consult
commit 1680f26f1c692743d3c9a38cfd33fcd5d943550f
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
consult-xref--preview: Simplify
---
consult-xref.el | 31 ++++++++++++++++---------------
1 file changed, 16 insertions(+), 15 deletions(-)
diff --git a/consult-xref.el b/consult-xref.el
index 2fb8883ce9..6a0dc03bc2 100644
--- a/consult-xref.el
+++ b/consult-xref.el
@@ -61,21 +61,22 @@
(funcall preview action
(when-let (loc (and cand (eq action 'preview)
(xref-item-location cand)))
- ;; Only preview file and buffer markers
- (pcase (type-of loc)
- ('xref-buffer-location
- (xref-location-marker loc))
- ((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)
- (if (eq type 'xref-file-location)
- (xref-file-location-column loc)
- 0)))
- (_ (message "No preview for %s" (type-of loc)) nil))))))))
+ (let ((type (type-of loc)))
+ ;; Only preview file and buffer markers
+ (pcase type
+ ('xref-buffer-location
+ (xref-location-marker loc))
+ ((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)
+ (if (eq type 'xref-file-location)
+ (xref-file-location-column loc)
+ 0)))
+ (_ (message "No preview for %s" type) nil)))))))))
(defun consult-xref--group (cand transform)
"Return title for CAND or TRANSFORM the candidate."