[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/hyperdrive 341f145411 33/82: Add: (hyperdrive--ensure-dot-
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/hyperdrive 341f145411 33/82: Add: (hyperdrive--ensure-dot-slash-prefix-path) |
Date: |
Mon, 25 Sep 2023 19:00:52 -0400 (EDT) |
branch: elpa/hyperdrive
commit 341f1454113f154ee4da805d0bd6e348b010dcb1
Author: Joseph Turner <joseph@ushin.org>
Commit: Joseph Turner <joseph@ushin.org>
Add: (hyperdrive--ensure-dot-slash-prefix-path)
---
hyperdrive-lib.el | 6 ++++++
hyperdrive-org.el | 23 ++++++++++-------------
2 files changed, 16 insertions(+), 13 deletions(-)
diff --git a/hyperdrive-lib.el b/hyperdrive-lib.el
index fece38561a..5f5297311a 100644
--- a/hyperdrive-lib.el
+++ b/hyperdrive-lib.el
@@ -1433,5 +1433,11 @@ Compares their public keys."
"Return non-nil if entries A and B have the same hyperdrive."
(hyperdrive-equal-p (hyperdrive-entry-hyperdrive a)
(hyperdrive-entry-hyperdrive b)))
+(defun hyperdrive--ensure-dot-slash-prefix-path (path)
+ "Return PATH. Unless PATH starts with \"/\" \"./\" or \"../\", add \"./\"."
+ (if (string-match-p (rx bos (or "/" "./" "../")) path)
+ path
+ (concat "./" path)))
+
(provide 'hyperdrive-lib)
;;; hyperdrive-lib.el ends here
diff --git a/hyperdrive-org.el b/hyperdrive-org.el
index 721b3f225f..f01da59c7b 100644
--- a/hyperdrive-org.el
+++ b/hyperdrive-org.el
@@ -217,25 +217,22 @@ Respects `hyperdrive-org-link-full-url' and
`org-link-file-path-type'."
(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))))
+ (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)))))))))
+ (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))
+ (setf destination (file-relative-name
+ (hyperdrive-entry-path target-entry)
+ (file-name-directory (hyperdrive-entry-path
target-entry)))))
+ (hyperdrive--ensure-dot-slash-prefix-path destination)))
;;;###autoload
(with-eval-after-load 'org
- [nongnu] elpa/hyperdrive de2e028534 12/82: Docs: Clarify link types, (continued)
- [nongnu] elpa/hyperdrive de2e028534 12/82: Docs: Clarify link types, ELPA Syncer, 2023/09/25
- [nongnu] elpa/hyperdrive eb84b2d2f5 16/82: Change: (hyperdrive-entry-create) Remove ENCODE argument, ELPA Syncer, 2023/09/25
- [nongnu] elpa/hyperdrive b2fe51ba3b 02/82: Comment: Add TODO, ELPA Syncer, 2023/09/25
- [nongnu] elpa/hyperdrive c740135a62 19/82: Change: (hyperdrive-org-link-full-url) Docstring, ELPA Syncer, 2023/09/25
- [nongnu] elpa/hyperdrive 81e01fcdc8 20/82: Fix: (hyperdrive--format-entry-url) Encode ?/ in URL fragment, ELPA Syncer, 2023/09/25
- [nongnu] elpa/hyperdrive 3cac9738b6 22/82: Change: (-deftest) Don't rebind hyperdrive--url-hexify-string, ELPA Syncer, 2023/09/25
- [nongnu] elpa/hyperdrive eef4f80848 23/82: Change: (hyperdrive-test-org-link tests) Change "file" to "path", ELPA Syncer, 2023/09/25
- [nongnu] elpa/hyperdrive 5709167d98 24/82: Test: different-drive-same-path-*, ELPA Syncer, 2023/09/25
- [nongnu] elpa/hyperdrive 9f102bdf44 29/82: Change: (hyperdrive--org-normalize-link) Assert current entry, ELPA Syncer, 2023/09/25
- [nongnu] elpa/hyperdrive 06ca835d69 32/82: Tidy: (hyperdrive--org-normalize-link) Add blank spaces, ELPA Syncer, 2023/09/25
- [nongnu] elpa/hyperdrive 341f145411 33/82: Add: (hyperdrive--ensure-dot-slash-prefix-path),
ELPA Syncer <=
- [nongnu] elpa/hyperdrive 696908c87f 35/82: Change: (--org-normalize-link) Remove hyperdrive-entry-equal-p check, ELPA Syncer, 2023/09/25
- [nongnu] elpa/hyperdrive 82f8b9d502 37/82: Fix: (--org-normalize-link) Use current entry, not target entry, ELPA Syncer, 2023/09/25
- [nongnu] elpa/hyperdrive 2a611e471f 42/82: Change: (--org-normalize-link) Add search-option to path link, ELPA Syncer, 2023/09/25
- [nongnu] elpa/hyperdrive 9fd2272ec1 47/82: Change: (--org-shorthand-link) Don't handle full "hyper://" URLs, ELPA Syncer, 2023/09/25
- [nongnu] elpa/hyperdrive a7bfbf8dee 38/82: Test: -org-link/same-drive-different-path-before-heading, ELPA Syncer, 2023/09/25
- [nongnu] elpa/hyperdrive 04de0cb01a 44/82: Change: (hyperdrive--org-normalize-link) Check search-option first, ELPA Syncer, 2023/09/25
- [nongnu] elpa/hyperdrive 16cdce78bf 40/82: Comment: Add TODO, ELPA Syncer, 2023/09/25
- [nongnu] elpa/hyperdrive 6aa9346618 41/82: Comment: Add TODO, ELPA Syncer, 2023/09/25
- [nongnu] elpa/hyperdrive 18d7821a82 48/82: Test: Add different-drive-different-path-* tests, ELPA Syncer, 2023/09/25
- [nongnu] elpa/hyperdrive 360c7d860f 49/82: Add: (hyperdrive--org-link-description) Utility function, ELPA Syncer, 2023/09/25