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

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

[nongnu] elpa/hyperdrive a4b2c538df 31/82: Tidy: (hyperdrive--org-normal


From: ELPA Syncer
Subject: [nongnu] elpa/hyperdrive a4b2c538df 31/82: Tidy: (hyperdrive--org-normalize-link) Use if instead of cond
Date: Mon, 25 Sep 2023 19:00:52 -0400 (EDT)

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

    Tidy: (hyperdrive--org-normalize-link) Use if instead of cond
---
 hyperdrive-org.el | 69 +++++++++++++++++++++++++++----------------------------
 1 file changed, 34 insertions(+), 35 deletions(-)

diff --git a/hyperdrive-org.el b/hyperdrive-org.el
index 54aa7b0925..3a4dd3cd44 100644
--- a/hyperdrive-org.el
+++ b/hyperdrive-org.el
@@ -198,41 +198,40 @@ Respects `hyperdrive-org-link-full-url' and 
`org-link-file-path-type'."
          target-entry :fragment-prefix fragment-prefix
          :with-path with-path
          :with-protocol with-protocol :host-format host-format)))
-    (cond ((hyperdrive-entry-equal-p hyperdrive-current-entry target-entry)
-           ;; Link points to same file on same hyperdrive: make link
-           ;; relative.
-           (setf destination
-                 (or search-option
-                     (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.
-                        (setf destination (hyperdrive-entry-path 
target-entry)))
-                       ('adaptive
-                        (setf destination
-                              (if (string-prefix-p (file-name-parent-directory
-                                                    (hyperdrive-entry-path 
hyperdrive-current-entry))
-                                                   (hyperdrive-entry-path 
target-entry))
-                                  ;; Link points to file in same directory 
tree: use relative link.
-                                  (concat "./"
-                                          (file-relative-name
-                                           (hyperdrive-entry-path target-entry)
-                                           (file-name-directory 
(hyperdrive-entry-path target-entry))))
-                                (hyperdrive-entry-path target-entry))))
-                       ('relative
-                        (setf destination
-                              (concat "./"
-                                      (file-relative-name
-                                       (hyperdrive-entry-path target-entry)
-                                       (file-name-directory 
(hyperdrive-entry-path target-entry))))))))))
-          ((hyperdrive-entry-hyperdrive-equal-p hyperdrive-current-entry 
target-entry)
-           ;; Link points to same hyperdrive as the file the link is in:
-           ;; make link relative.
-           (setf destination (concat "./"
-                                     (file-relative-name
-                                      (hyperdrive-entry-path target-entry)
-                                      (file-name-directory 
(hyperdrive-entry-path target-entry)))))))
+    (if (hyperdrive-entry-equal-p hyperdrive-current-entry target-entry)
+        ;; Link points to same file on same hyperdrive: make link
+        ;; relative.
+        (setf destination
+              (or search-option
+                  (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.
+                     (setf destination (hyperdrive-entry-path target-entry)))
+                    ('adaptive
+                     (setf destination
+                           (if (string-prefix-p (file-name-parent-directory
+                                                 (hyperdrive-entry-path 
hyperdrive-current-entry))
+                                                (hyperdrive-entry-path 
target-entry))
+                               ;; Link points to file in same directory tree: 
use relative link.
+                               (concat "./"
+                                       (file-relative-name
+                                        (hyperdrive-entry-path target-entry)
+                                        (file-name-directory 
(hyperdrive-entry-path target-entry))))
+                             (hyperdrive-entry-path target-entry))))
+                    ('relative
+                     (setf destination
+                           (concat "./"
+                                   (file-relative-name
+                                    (hyperdrive-entry-path target-entry)
+                                    (file-name-directory 
(hyperdrive-entry-path target-entry)))))))))
+      ;; Link points to same hyperdrive as the file the link is in:
+      ;; make link relative.
+      (setf destination (concat "./"
+                                (file-relative-name
+                                 (hyperdrive-entry-path target-entry)
+                                 (file-name-directory (hyperdrive-entry-path 
target-entry))))))
     destination))
 
 ;;;###autoload



reply via email to

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