emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/embark 573f2bd12e 1/2: Revert functionality for xref ex


From: ELPA Syncer
Subject: [elpa] externals/embark 573f2bd12e 1/2: Revert functionality for xref export buffers
Date: Sat, 23 Apr 2022 12:57:31 -0400 (EDT)

branch: externals/embark
commit 573f2bd12e339e5a50ef9e464e90436d9ab9ce6e
Author: Omar Antolín <omar.antolin@gmail.com>
Commit: Omar Antolín <omar.antolin@gmail.com>

    Revert functionality for xref export buffers
---
 embark-consult.el | 36 +++++++++++++++++++++++++++---------
 1 file changed, 27 insertions(+), 9 deletions(-)

diff --git a/embark-consult.el b/embark-consult.el
index 2187451583..171081314c 100644
--- a/embark-consult.el
+++ b/embark-consult.el
@@ -218,15 +218,33 @@ This function is meant to be added to 
`embark-collect-mode-hook'."
 
 (defun embark-consult-export-xref (items)
   "Create an xref buffer listing ITEMS."
-  (let ((xref-items (mapcar (lambda (item)
-                              (get-text-property 0 'consult-xref item))
-                            items)))
-    (set-buffer
-     (xref--show-xref-buffer
-      (lambda () xref-items)
-      `((window . ,(selected-window))
-        (auto-jump . ,xref-auto-jump-to-first-xref)
-        (display-action))))))
+  (cl-flet ((xref-items (items)
+              (mapcar (lambda (item) (get-text-property 0 'consult-xref item))
+                      items)))
+    (let ((fetcher consult-xref--fetcher)
+          (input (minibuffer-contents)))
+      (set-buffer
+       (xref--show-xref-buffer
+        (lambda ()
+          (catch 'xref-items
+            (minibuffer-with-setup-hook
+                (lambda ()
+                  (insert input)
+                  (add-hook 'minibuffer-exit-hook
+                            (lambda ()
+                              (throw 'xref-items
+                                (xref-items
+                                 (or
+                                  (plist-get
+                                   (embark--maybe-transform-candidates)
+                                   :candidates)
+                                  (user-error "No candidates for export")))))
+                            nil t))
+              (consult-xref fetcher))))
+        `((fetched-xrefs . ,(xref-items items))
+          (window . ,(embark--target-window))
+          (auto-jump . ,xref-auto-jump-to-first-xref)
+          (display-action)))))))
 
 (setf (alist-get 'consult-xref embark-exporters-alist)
       #'embark-consult-export-xref)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]