branch: elpa/hyperdrive
commit c99952e047b7914a9c00ddc567daa9899b1ec4f3
Author: Adam Porter <a...@alphapapa.net>
Commit: Joseph Turner <jos...@ushin.org>

    Change: (hyperdrive-up) Callback correctly
---
 hyperdrive-menu.el | 12 +++++++-----
 hyperdrive.el      |  7 +++++--
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/hyperdrive-menu.el b/hyperdrive-menu.el
index d148523f64..9bb1513219 100644
--- a/hyperdrive-menu.el
+++ b/hyperdrive-menu.el
@@ -125,11 +125,13 @@
                  (propertize (hyperdrive--format-path (hyperdrive-entry-path 
entry))
                              'face 'transient-value))))
      ("g" "Refresh" revert-buffer)
-     ("^" "Up to parent" (lambda ()
-                           (interactive)
-                           (hyperdrive-up (oref transient-current-prefix scope)
-                                          :then (lambda ()
-                                                  (call-interactively 
#'hyperdrive-menu))))
+     ("^" "Up to parent"
+      (lambda ()
+        (interactive)
+        (hyperdrive-up (oref transient-current-prefix scope)
+                       :then (lambda ()
+                               (pop-to-buffer (current-buffer) 
'(display-buffer-same-window))
+                               (call-interactively #'hyperdrive-menu))))
       :inapt-if-not (lambda ()
                       (hyperdrive-parent (oref transient--prefix scope)))
       :transient t)
diff --git a/hyperdrive.el b/hyperdrive.el
index f70e73021b..135e2c068a 100644
--- a/hyperdrive.el
+++ b/hyperdrive.el
@@ -525,7 +525,7 @@ hyperdrive directory listing or a `hyperdrive-mode' file 
buffer."
     (kill-new url)
     (hyperdrive-message "%s" url)))
 
-(cl-defun hyperdrive-up (entry &key then)
+(cl-defun hyperdrive-up (entry &key (then nil then-set-p))
   "Go up to parent directory of ENTRY.
 Interactively, use the `hyperdrive-current-entry'.  If THEN, pass
 it to `hyperdrive-open'."
@@ -536,7 +536,10 @@ it to `hyperdrive-open'."
                  (list hyperdrive-current-entry)))
   (if-let ((parent (hyperdrive-parent entry)))
       ;; TODO: Go to entry in parent directory.
-      (hyperdrive-open parent :then then)
+      (if then-set-p
+          (hyperdrive-open parent :then then)
+        ;; Allow default callback to be used.
+        (hyperdrive-open parent))
     (hyperdrive-user-error "At root directory")))
 
 (defvar-keymap hyperdrive-up-map

Reply via email to