[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/hyperdrive 80ec05b3b5 28/82: Add: (--org-normalize-link) G
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/hyperdrive 80ec05b3b5 28/82: Add: (--org-normalize-link) Gut --org-insert-link-after-advice |
Date: |
Mon, 25 Sep 2023 19:00:51 -0400 (EDT) |
branch: elpa/hyperdrive
commit 80ec05b3b5b27f3e543c16ef2a0aaebf991fa775
Author: Joseph Turner <joseph@ushin.org>
Commit: Joseph Turner <joseph@ushin.org>
Add: (--org-normalize-link) Gut --org-insert-link-after-advice
---
hyperdrive-org.el | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/hyperdrive-org.el b/hyperdrive-org.el
index c9623fa835..6982ab7ce9 100644
--- a/hyperdrive-org.el
+++ b/hyperdrive-org.el
@@ -172,9 +172,17 @@ the current location."
(defun hyperdrive--org-insert-link-after-advice (&rest _)
"Modify just-inserted link as appropriate for `hyperdrive-mode' buffers."
(when (and hyperdrive-mode hyperdrive-current-entry)
- (let* ((link-element (org-element-context))
- (_ (cl-assert (eq 'link (car link-element))))
- (url (org-element-property :raw-link link-element))
+ (let ((link-element (org-element-context)))
+ (cl-assert (eq 'link (car link-element)))
+ (delete-region (org-element-property :begin link-element)
+ (org-element-property :end link-element))
+ (insert (org-link-make-string (hyperdrive--org-normalize-link
link-element))))))
+
+(defun hyperdrive--org-normalize-link (link-element)
+ "Return normalized copy of \"hyper://\" LINK-ELEMENT.
+Respects `hyperdrive-org-link-full-url' and `org-link-file-path-type'."
+ (when hyperdrive-current-entry
+ (let* ((url (org-element-property :raw-link link-element))
(target-entry (hyperdrive-url-entry url))
(search-option (alist-get 'target (hyperdrive-entry-etc
target-entry)))
(host-format '(public-key)) (with-path t) (with-protocol t)
@@ -228,9 +236,7 @@ the current location."
target-entry :fragment-prefix fragment-prefix
:with-path with-path
:with-protocol with-protocol :host-format
host-format))))
- (delete-region (org-element-property :begin link-element)
- (org-element-property :end link-element))
- (insert (org-link-make-string destination)))))
+ destination)))
;;;###autoload
(with-eval-after-load 'org
- [nongnu] elpa/hyperdrive bdf9a94b49 09/82: WIP, (continued)
- [nongnu] elpa/hyperdrive bdf9a94b49 09/82: WIP, ELPA Syncer, 2023/09/25
- [nongnu] elpa/hyperdrive 96d458868b 10/82: WIP, ELPA Syncer, 2023/09/25
- [nongnu] elpa/hyperdrive 8a453f0eb4 14/82: WIP: All tests passing! (so far), ELPA Syncer, 2023/09/25
- [nongnu] elpa/hyperdrive 82305e861b 15/82: WIP: Have macro define narrower tests, ELPA Syncer, 2023/09/25
- [nongnu] elpa/hyperdrive a72cf3820d 17/82: WIP: All tests pass, etc., ELPA Syncer, 2023/09/25
- [nongnu] elpa/hyperdrive a040fa2686 18/82: WIP, ELPA Syncer, 2023/09/25
- [nongnu] elpa/hyperdrive 5726648878 21/82: Change: (hyperdrive--format-entry-url) Docstring, ELPA Syncer, 2023/09/25
- [nongnu] elpa/hyperdrive 7d3662f842 25/82: Comment: Add TODO, ELPA Syncer, 2023/09/25
- [nongnu] elpa/hyperdrive 016582b1a2 26/82: Tidy: (--org-insert-link-after-advice) Bind search-option at top, ELPA Syncer, 2023/09/25
- [nongnu] elpa/hyperdrive 96129bb5db 27/82: Tidy: Whitespace, ELPA Syncer, 2023/09/25
- [nongnu] elpa/hyperdrive 80ec05b3b5 28/82: Add: (--org-normalize-link) Gut --org-insert-link-after-advice,
ELPA Syncer <=
- [nongnu] elpa/hyperdrive 89fa2fe4a9 30/82: Tidy: (hyperdrive--org-normalize-link) Deduplicate full URL codepath, ELPA Syncer, 2023/09/25
- [nongnu] elpa/hyperdrive a4b2c538df 31/82: Tidy: (hyperdrive--org-normalize-link) Use if instead of cond, ELPA Syncer, 2023/09/25
- [nongnu] elpa/hyperdrive 36a18f326e 34/82: Change: (--org-normalize-link) Return early with search option, ELPA Syncer, 2023/09/25
- [nongnu] elpa/hyperdrive 91c3478593 36/82: Change: (hyperdrive--org-normalize-link) Use file-name-directory, ELPA Syncer, 2023/09/25
- [nongnu] elpa/hyperdrive c4567c4b9f 46/82: Change: (hyperdrive--org-normalize-link) Use hyperdrive-entry-url, ELPA Syncer, 2023/09/25
- [nongnu] elpa/hyperdrive 28151f3db9 39/82: Change: (--org-normalize-link) Split adaptive into absolute/relative, ELPA Syncer, 2023/09/25
- [nongnu] elpa/hyperdrive 25af84f5e4 52/82: Change: (hyperdrive--org-link) Add "::" to stored link, ELPA Syncer, 2023/09/25
- [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