[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/hyperdrive 8c4c989c01 75/82: WIP: Don't store "::" in targ
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/hyperdrive 8c4c989c01 75/82: WIP: Don't store "::" in target in entry etc slot |
Date: |
Mon, 25 Sep 2023 19:00:56 -0400 (EDT) |
branch: elpa/hyperdrive
commit 8c4c989c017f635685f5bdd2d633a047842f4e31
Author: Joseph Turner <joseph@ushin.org>
Commit: Joseph Turner <joseph@ushin.org>
WIP: Don't store "::" in target in entry etc slot
---
hyperdrive-lib.el | 5 +++--
hyperdrive-org.el | 15 ++++++++-------
2 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/hyperdrive-lib.el b/hyperdrive-lib.el
index b033121056..0e8218c259 100644
--- a/hyperdrive-lib.el
+++ b/hyperdrive-lib.el
@@ -271,7 +271,7 @@ before making the entry struct."
(or (gethash host hyperdrive-hyperdrives)
(hyperdrive-create :public-key host)))))
(etc (when target
- (list (cons 'target (url-unhex-string target)))))
+ `((target . ,(substring (url-unhex-string target)
(length "::"))))))
(version (pcase path
((rx "/$/version/" (let v (1+ num)) (let p (0+
anything)))
(setf path p)
@@ -970,7 +970,8 @@ Path and target fragment are URI-encoded."
(version-part (and version (format "/$/version/%s" version)))
((map target) etc)
(target-part (when (and with-target target)
- (concat "#" (url-hexify-string target))))
+ (concat "#" (url-hexify-string "::")
+ (url-hexify-string target))))
(path (when with-path
(hyperdrive--url-hexify-string path)))
(url (concat protocol host version-part path target-part)))
diff --git a/hyperdrive-org.el b/hyperdrive-org.el
index b558b18202..524bfaf9da 100644
--- a/hyperdrive-org.el
+++ b/hyperdrive-org.el
@@ -94,8 +94,8 @@ raw URL, not an Org link."
(when hyperdrive-mode
(let* ((heading (org-entry-get (point) "ITEM"))
(custom-id (org-entry-get (point) "CUSTOM_ID"))
- (fragment (cond (custom-id (concat "::#" custom-id))
- (heading (concat "::*" heading))))
+ (fragment (cond (custom-id (concat "#" custom-id))
+ (heading (concat "*" heading))))
(entry-copy (hyperdrive-copy-tree hyperdrive-current-entry t))
(_ (setf (alist-get 'target (hyperdrive-entry-etc entry-copy))
fragment))
(raw-url (hyperdrive-entry-url entry-copy)))
@@ -118,8 +118,7 @@ raw URL, not an Org link."
"Go to TARGET in current Org buffer.
TARGET may be a CUSTOM_ID or a headline."
(cl-assert (eq 'org-mode major-mode))
- ;; Remove leading "::" from target.
- (org-link-search (substring target (length "::"))))
+ (org-link-search target))
(defun hyperdrive-org-link-complete ()
"Create a hyperdrive org link."
@@ -179,9 +178,11 @@ FIXME: Docstring, maybe move details from
`hyperdrive-org-link-full-url'."
(let ((search-option (alist-get 'target (hyperdrive-entry-etc entry))))
(when (and search-option
(hyperdrive-entry-equal-p hyperdrive-current-entry entry))
- ;; Search option alone: Remove leading "::"
- (cl-return-from hyperdrive--org-shorthand-link
- (substring search-option (length "::"))))
+ (cl-return-from hyperdrive--org-shorthand-link search-option))
+
+ ;; Search option alone: Remove leading "::"
+ (when search-option
+ (cl-callf2 concat "::" search-option))
(let ((adaptive-target-p
;; See the `adaptive' option in `org-link-file-path-type'.
- [nongnu] elpa/hyperdrive 032a77ea2d 43/82: Test: -org-link/same-drive-different-path with heading, (continued)
- [nongnu] elpa/hyperdrive 032a77ea2d 43/82: Test: -org-link/same-drive-different-path with heading, ELPA Syncer, 2023/09/25
- [nongnu] elpa/hyperdrive c99013b23a 61/82: Comment: Add outline heading, ELPA Syncer, 2023/09/25
- [nongnu] elpa/hyperdrive 2c3bc705c7 56/82: Test: Add hyperdrive-test-org-store-link-deftest macro, ELPA Syncer, 2023/09/25
- [nongnu] elpa/hyperdrive 46e6a1201f 54/82: Comment: Add TODO, ELPA Syncer, 2023/09/25
- [nongnu] elpa/hyperdrive 68e55a0ab6 55/82: Test: Add hyperdrive-test-org-store-link-scenarios, ELPA Syncer, 2023/09/25
- [nongnu] elpa/hyperdrive 6c203e3e34 58/82: Test: Test inserting links, ELPA Syncer, 2023/09/25
- [nongnu] elpa/hyperdrive 0d92314c4f 65/82: Docs: Document new advised org-insert-link behavior, ELPA Syncer, 2023/09/25
- [nongnu] elpa/hyperdrive 834c4a8908 63/82: Change: Rename test-hyperdrive-org.el, ELPA Syncer, 2023/09/25
- [nongnu] elpa/hyperdrive 658164484b 68/82: Tidy: (hyperdrive-test-org-entry-create) Don't bind org-stored-links, ELPA Syncer, 2023/09/25
- [nongnu] elpa/hyperdrive 373d55c1d8 73/82: Comment: Add TODO, ELPA Syncer, 2023/09/25
- [nongnu] elpa/hyperdrive 8c4c989c01 75/82: WIP: Don't store "::" in target in entry etc slot,
ELPA Syncer <=
- [nongnu] elpa/hyperdrive 759142d99e 77/82: Tests: Remove old Org link tests from main test file, ELPA Syncer, 2023/09/25