[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/hyperdrive 505ee2626b 45/82: Change: (hyperdrive--format-e
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/hyperdrive 505ee2626b 45/82: Change: (hyperdrive--format-entry-url) Hardcode fragment-prefix to # |
Date: |
Mon, 25 Sep 2023 19:00:53 -0400 (EDT) |
branch: elpa/hyperdrive
commit 505ee2626b19a81c69dfd14b0d85445f248710a0
Author: Joseph Turner <joseph@ushin.org>
Commit: Joseph Turner <joseph@ushin.org>
Change: (hyperdrive--format-entry-url) Hardcode fragment-prefix to #
---
hyperdrive-lib.el | 3 +--
hyperdrive-org.el | 53 ++++++++++++++++++++++++++++-------------------------
2 files changed, 29 insertions(+), 27 deletions(-)
diff --git a/hyperdrive-lib.el b/hyperdrive-lib.el
index 5f5297311a..ed69d98b8a 100644
--- a/hyperdrive-lib.el
+++ b/hyperdrive-lib.el
@@ -936,7 +936,6 @@ When WITH-VERSION or ENTRY's version is nil, omit
(version:VERSION)."
(cl-defun hyperdrive--format-entry-url
(entry &key (host-format '(public-key domain))
- (fragment-prefix "#")
(with-path t)
(with-protocol t) (with-help-echo t) (with-target t) (with-faces t))
"Return ENTRY's URL.
@@ -971,7 +970,7 @@ 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 fragment-prefix (url-hexify-string
target))))
+ (concat "#" (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 4e7b3b5181..63e11d6373 100644
--- a/hyperdrive-org.el
+++ b/hyperdrive-org.el
@@ -186,26 +186,30 @@ FIXME: Docstring, maybe move details from
`hyperdrive-org-link-full-url'."
(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)
- fragment-prefix)
-
- (when (and search-option
- (hyperdrive-entry-equal-p hyperdrive-current-entry
target-entry))
- ;; Search option alone
- (cl-return-from hyperdrive--org-normalize-link search-option))
+ (host-format '(public-key)) (with-path t) (with-protocol t))
(when (or hyperdrive-org-link-full-url
(not (hyperdrive-entry-hyperdrive-equal-p
hyperdrive-current-entry target-entry)))
;; Full "hyper://" URL
(when search-option
- (setf fragment-prefix (concat "#" (url-hexify-string "::"))))
+ ;; When linking to a different file, prefix search option with "::".
+ (cl-callf2 concat "::" (alist-get 'target (hyperdrive-entry-etc
target-entry))))
(cl-return-from hyperdrive--org-normalize-link
(hyperdrive--format-entry-url
- target-entry :fragment-prefix fragment-prefix
+ target-entry
:with-path with-path
:with-protocol with-protocol :host-format host-format)))
+ (when (and search-option
+ (hyperdrive-entry-equal-p hyperdrive-current-entry
target-entry))
+ ;; Search option alone
+ (cl-return-from hyperdrive--org-normalize-link search-option))
+
+ (when search-option
+ ;; When linking to a different file, prefix search option with "::".
+ (cl-callf2 concat "::" search-option))
+
(let ((adaptive-target-p
;; See the `adaptive' option in `org-link-file-path-type'.
(string-prefix-p
@@ -213,22 +217,21 @@ FIXME: Docstring, maybe move details from
`hyperdrive-org-link-full-url'."
(hyperdrive-entry-path hyperdrive-current-entry))
(hyperdrive-entry-path target-entry))))
(hyperdrive--ensure-dot-slash-prefix-path
- (apply #'concat
- (pcase org-link-file-path-type
- ;; TODO: Handle `org-link-file-path-type' as a function.
- ((or 'absolute
- ;; TODO: Consider special-casing `noabbrev' - who knows?
- ;; `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)))))
- (when search-option
- (list "::" search-option)))))))
+ (concat
+ (pcase org-link-file-path-type
+ ;; TODO: Handle `org-link-file-path-type' as a function.
+ ((or 'absolute
+ ;; TODO: Consider special-casing `noabbrev' - who knows?
+ ;; `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)))))
+ search-option)))))
;;;###autoload
(with-eval-after-load 'org
- [nongnu] elpa/hyperdrive 2a611e471f 42/82: Change: (--org-normalize-link) Add search-option to path link, (continued)
- [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
- [nongnu] elpa/hyperdrive 3ea6fa6bc1 51/82: Comment: Correct explanation, ELPA Syncer, 2023/09/25
- [nongnu] elpa/hyperdrive 1fb11bed18 50/82: Fix: (hyperdrive--org-insert-link-after-advice) Preserve description, ELPA Syncer, 2023/09/25
- [nongnu] elpa/hyperdrive 505ee2626b 45/82: Change: (hyperdrive--format-entry-url) Hardcode fragment-prefix to #,
ELPA Syncer <=
- [nongnu] elpa/hyperdrive 923b1e6371 62/82: Comment: Remove "ing", ELPA Syncer, 2023/09/25
- [nongnu] elpa/hyperdrive 0b5adb547f 60/82: Test: Insert full "hyper://" links, ELPA Syncer, 2023/09/25
- [nongnu] elpa/hyperdrive dd795f5f2a 53/82: Test: Add tests for storing links, ELPA Syncer, 2023/09/25
- [nongnu] elpa/hyperdrive 990d23ab55 57/82: Test: Rename org-mode/* to org-mode-*, ELPA Syncer, 2023/09/25
- [nongnu] elpa/hyperdrive dc8af9b72c 59/82: Test: Remove roundtrip tests, ELPA Syncer, 2023/09/25
- [nongnu] elpa/hyperdrive d704c5a181 64/82: Meta: Update changelog, ELPA Syncer, 2023/09/25
- [nongnu] elpa/hyperdrive f1bb94bb83 66/82: Change: (hyperdrive-org-link-follow) Don't jump to ID target, ELPA Syncer, 2023/09/25
- [nongnu] elpa/hyperdrive 6293463834 67/82: Comment: Add TODO, ELPA Syncer, 2023/09/25
- [nongnu] elpa/hyperdrive 43f50f2ae7 69/82: Change/Fix: (hyperdrive--org-open-at-point) Don't handle fuzzy links, ELPA Syncer, 2023/09/25
- [nongnu] elpa/hyperdrive 27d352dda2 70/82: Comment: Remove TODO, ELPA Syncer, 2023/09/25