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

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

[nongnu] elpa/hyperdrive 28151f3db9 39/82: Change: (--org-normalize-link


From: ELPA Syncer
Subject: [nongnu] elpa/hyperdrive 28151f3db9 39/82: Change: (--org-normalize-link) Split adaptive into absolute/relative
Date: Mon, 25 Sep 2023 19:00:52 -0400 (EDT)

branch: elpa/hyperdrive
commit 28151f3db9cd5c35ff66aa10c73fd622118875f0
Author: Joseph Turner <joseph@ushin.org>
Commit: Joseph Turner <joseph@ushin.org>

    Change: (--org-normalize-link) Split adaptive into absolute/relative
---
 hyperdrive-org.el | 39 +++++++++++++++++++--------------------
 1 file changed, 19 insertions(+), 20 deletions(-)

diff --git a/hyperdrive-org.el b/hyperdrive-org.el
index 0035682133..828001fdbc 100644
--- a/hyperdrive-org.el
+++ b/hyperdrive-org.el
@@ -205,26 +205,25 @@ Respects `hyperdrive-org-link-full-url' and 
`org-link-file-path-type'."
       ;; Search option alone
       (cl-return-from hyperdrive--org-normalize-link search-option))
 
-    (hyperdrive--ensure-dot-slash-prefix-path
-     (pcase org-link-file-path-type
-       ;; TODO: Handle `org-link-file-path-type' as a function.
-       ((or 'absolute 'noabbrev)
-        ;; These two options are the same for our purposes,
-        ;; because hyperdrives have no home directory.
-        (hyperdrive-entry-path target-entry))
-       ('adaptive
-        (if (string-prefix-p (file-name-directory
-                              (hyperdrive-entry-path hyperdrive-current-entry))
-                             (hyperdrive-entry-path target-entry))
-            ;; Link points to file in same directory tree: use relative link.
-            (file-relative-name
-             (hyperdrive-entry-path target-entry)
-             (file-name-directory (hyperdrive-entry-path 
hyperdrive-current-entry)))
-          (hyperdrive-entry-path target-entry)))
-       ('relative
-        (file-relative-name
-         (hyperdrive-entry-path target-entry)
-         (file-name-directory (hyperdrive-entry-path 
hyperdrive-current-entry))))))))
+    (let ((adaptive-target-p
+           ;; See the `adaptive' option in `org-link-file-path-type'.
+           (string-prefix-p
+            (file-name-directory
+             (hyperdrive-entry-path hyperdrive-current-entry))
+            (hyperdrive-entry-path target-entry))))
+      (hyperdrive--ensure-dot-slash-prefix-path
+       (pcase org-link-file-path-type
+         ;; TODO: Handle `org-link-file-path-type' as a function.
+         ((or 'absolute
+              ;; `noabbrev' is like `absolute' because hyperdrives have
+              ;; no home directory.
+              'noabbrev
+              (and 'adaptive (guard (not adaptive-target-p))))
+          (hyperdrive-entry-path target-entry))
+         ((or 'relative (and 'adaptive (guard adaptive-target-p)))
+          (file-relative-name
+           (hyperdrive-entry-path target-entry)
+           (file-name-directory (hyperdrive-entry-path 
hyperdrive-current-entry)))))))))
 
 ;;;###autoload
 (with-eval-after-load 'org



reply via email to

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