branch: elpa/hyperdrive
commit 0af765ab019912b5a0bbdd91529bc51745d48f42
Author: Joseph Turner <jos...@ushin.org>
Commit: Joseph Turner <jos...@ushin.org>

    Change: (h/complete-hyperdrive) Use transient menu drive as current
    
    Now if h/menu-hyperdrive is open, h/complete-hyperdrive will return
    its hyperdrive.
---
 hyperdrive-lib.el | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/hyperdrive-lib.el b/hyperdrive-lib.el
index 4f8c20c201..628d89c429 100644
--- a/hyperdrive-lib.el
+++ b/hyperdrive-lib.el
@@ -1175,11 +1175,16 @@ case, when PREDICATE, only offer hyperdrives matching 
it."
     (setf predicate #'always))
 
   ;; Return current drive when appropriate.
-  (when-let* (((not force-prompt))
-              (h/current-entry)
-              (current-hyperdrive (he/hyperdrive h/current-entry))
-              ((funcall predicate current-hyperdrive)))
-    (cl-return-from h/complete-hyperdrive current-hyperdrive))
+  (unless force-prompt
+    ;; If transient menu is open, use that as the current hyperdrive.
+    (when-let* ((obj (transient-active-prefix '(h/menu-hyperdrive)))
+                (transient-hyperdrive (oref obj scope))
+                ((funcall predicate transient-hyperdrive)))
+      (cl-return-from h/complete-hyperdrive transient-hyperdrive))
+    (when-let* ((h/current-entry)
+                (current-hyperdrive (he/hyperdrive h/current-entry))
+                ((funcall predicate current-hyperdrive)))
+      (cl-return-from h/complete-hyperdrive current-hyperdrive)))
 
   ;; Otherwise, prompt for drive.
   (let* ((current-hyperdrive (and h/current-entry

Reply via email to