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

    Fix: (h/read-url) Prompt for entry at point in dir-mode
---
 hyperdrive-lib.el | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/hyperdrive-lib.el b/hyperdrive-lib.el
index 16f096d035..21e24b382a 100644
--- a/hyperdrive-lib.el
+++ b/hyperdrive-lib.el
@@ -1284,10 +1284,12 @@ is passed to `read-string' as its DEFAULT-VALUE 
argument."
 (cl-defun h/read-url (&key (prompt "Hyperdrive URL"))
   "Return URL trimmed of whitespace.
 Prompts with PROMPT.  Defaults to current entry if it exists."
-  (let ((default (and h/current-entry
-                      (he/url h/current-entry))))
-    (string-trim (read-string (format-prompt prompt default)
-                              nil 'h//url-history default))))
+  (let* ((default-entry
+          (cond ((derived-mode-p 'h/dir-mode) (h/dir--entry-at-point))
+                (h/current-entry h/current-entry)))
+         (default-url (and default-entry (he/url default-entry))))
+    (string-trim (read-string (format-prompt prompt default-url)
+                              nil 'h//url-history default-url))))
 
 (defvar h//name-history nil
   "Minibuffer history of `hyperdrive-read-name'.")

Reply via email to