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

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

[nongnu] elpa/hyperdrive 2678c1d7ca 064/102: Change: Replace hyperdrive-


From: ELPA Syncer
Subject: [nongnu] elpa/hyperdrive 2678c1d7ca 064/102: Change: Replace hyperdrive--org- prefix with hyperdrive-org--
Date: Wed, 29 Nov 2023 04:00:54 -0500 (EST)

branch: elpa/hyperdrive
commit 2678c1d7ca025dbfe83ae7797ed26aca3bef281b
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>

    Change: Replace hyperdrive--org- prefix with hyperdrive-org--
    
    A few symbols already used the latter prefix and there was a TODO
    item about having to decide which prefix should be used.  Since we
    are also going to use shorthands, it IMO makes more sense to use the
    latter prefix.  The "ho-" shorthand prefix makes more sense if the
    two affected prefixes are "hyperdrive-org-" and "hyperdrive-org--".
---
 hyperdrive-org.el                 | 28 +++++++++++++---------------
 tests/test-hyperdrive-markdown.el |  2 +-
 tests/test-hyperdrive-org.el      |  6 +++---
 3 files changed, 17 insertions(+), 19 deletions(-)

diff --git a/hyperdrive-org.el b/hyperdrive-org.el
index dcf3130c69..63725b4245 100644
--- a/hyperdrive-org.el
+++ b/hyperdrive-org.el
@@ -59,7 +59,7 @@ which see."
   (when hyperdrive-current-entry
     (pcase-let (((map type link description)
                  (pcase major-mode
-                   ('org-mode (hyperdrive--org-link))
+                   ('org-mode (hyperdrive-org--link))
                    ('hyperdrive-dir-mode
                     (let ((entry (hyperdrive-dir--entry-at-point)))
                       `((type . "hyper://")
@@ -71,7 +71,7 @@ which see."
       (org-link-store-props :type type :link link :description description)
       t)))
 
-(defun hyperdrive--org-link (&optional raw-url-p)
+(defun hyperdrive-org--link (&optional raw-url-p)
   "Return Org alist for current Org buffer.
 Attempts to link to the entry at point.  If RAW-URL-P, return a
 raw URL, not an Org link."
@@ -114,7 +114,7 @@ raw URL, not an Org link."
   ;; have been configured with `org-link-set-parameters'.
   (hyperdrive-open (hyperdrive-url-entry (concat "hyper:" url))))
 
-(defun hyperdrive--org-link-goto (target)
+(defun hyperdrive-org--link-goto (target)
   "Go to TARGET in current Org buffer.
 TARGET may be a CUSTOM_ID or a headline."
   (cl-assert (eq 'org-mode major-mode))
@@ -125,17 +125,15 @@ TARGET may be a CUSTOM_ID or a headline."
   ;; TODO: Support other hyper:// links like diffs when implemented.
   (hyperdrive-entry-url (hyperdrive-read-entry :read-version t)))
 
-;; TODO: hyperdrive--org-* or hyperdrive-org--*?
-
-(defun hyperdrive--org-open-at-point ()
+(defun hyperdrive-org--open-at-point ()
   "Handle relative links in hyperdrive-mode org files.
 
 Added to `org-open-at-point-functions' in order to short-circuit
 the logic for handling links of \"file\" type."
   (when hyperdrive-mode
-    (hyperdrive-open (hyperdrive--org-link-entry-at-point))))
+    (hyperdrive-open (hyperdrive-org--link-entry-at-point))))
 
-(defun hyperdrive--org-link-entry-at-point ()
+(defun hyperdrive-org--link-entry-at-point ()
   "Return a hyperdrive entry for the Org link at point."
   ;; This function is not in the code path for full URLs or links that
   ;; are only search options.
@@ -156,13 +154,13 @@ the logic for handling links of \"file\" type."
                            :etc `((target . ,(org-element-property 
:search-option context))))))
         entry))))
 
-(defun hyperdrive--org-insert-link-after-advice (&rest _)
+(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))
-           (desc (hyperdrive--org-link-description link-element))
+           (desc (hyperdrive-org--link-description link-element))
            (target-entry (hyperdrive-url-entry url)))
       (when (and (not hyperdrive-org-link-full-url)
                  (hyperdrive-entry-hyperdrive-equal-p
@@ -170,10 +168,10 @@ the logic for handling links of \"file\" type."
         (delete-region (org-element-property :begin link-element)
                        (org-element-property :end link-element))
         (insert (org-link-make-string
-                 (hyperdrive--org-shorthand-link target-entry)
+                 (hyperdrive-org--shorthand-link target-entry)
                  desc))))))
 
-(cl-defun hyperdrive--org-shorthand-link (entry)
+(cl-defun hyperdrive-org--shorthand-link (entry)
   "Return a non-\"hyper://\"-prefixed link to ENTRY.
 Respects `hyperdrive-org-link-full-url' and `org-link-file-path-type'."
   ;; FIXME: Docstring, maybe move details from `hyperdrive-org-link-full-url'.
@@ -181,7 +179,7 @@ Respects `hyperdrive-org-link-full-url' and 
`org-link-file-path-type'."
   (let ((search-option (alist-get 'target (hyperdrive-entry-etc entry))))
     (when (and search-option
                (hyperdrive-entry-equal-p hyperdrive-current-entry entry))
-      (cl-return-from hyperdrive--org-shorthand-link search-option))
+      (cl-return-from hyperdrive-org--shorthand-link search-option))
 
     ;; Search option alone: Remove leading "::"
     (when search-option
@@ -210,7 +208,7 @@ Respects `hyperdrive-org-link-full-url' and 
`org-link-file-path-type'."
             (file-name-directory (hyperdrive-entry-path 
hyperdrive-current-entry)))))
         search-option)))))
 
-(defun hyperdrive--org-link-description (link)
+(defun hyperdrive-org--link-description (link)
   "Return description of Org LINK or nil if it has none."
   ;; TODO: Is there a built-in solution?
   (when-let* ((desc-begin (org-element-property :contents-begin link))
@@ -228,7 +226,7 @@ Respects `hyperdrive-org-link-full-url' and 
`org-link-file-path-type'."
     ;; buffers as links to files within that hyperdrive.  Only add
     ;; this function to the variable after `hyperdrive' is loaded so
     ;; that `hyperdrive-mode' will be defined.
-    (cl-pushnew #'hyperdrive--org-open-at-point org-open-at-point-functions)))
+    (cl-pushnew #'hyperdrive-org--open-at-point org-open-at-point-functions)))
 
 ;;;; Footer
 
diff --git a/tests/test-hyperdrive-markdown.el 
b/tests/test-hyperdrive-markdown.el
index 58eb08b575..49e6a075b6 100644
--- a/tests/test-hyperdrive-markdown.el
+++ b/tests/test-hyperdrive-markdown.el
@@ -40,7 +40,7 @@
 ;;;; Parse relative/absolute link into entry tests
 
 ;; Neither full "hyper://"-prefixed URLs, nor links which are only search
-;; options, are handled by `hyperdrive--org-link-entry-at-point'.
+;; options, are handled by `hyperdrive-org--link-entry-at-point'.
 
 (defmacro hyperdrive-test-markdown-parse-link-deftest (name current-entry link 
parsed-entry)
   (declare (indent defun))
diff --git a/tests/test-hyperdrive-org.el b/tests/test-hyperdrive-org.el
index 1a8fd336bc..1772fa7d94 100644
--- a/tests/test-hyperdrive-org.el
+++ b/tests/test-hyperdrive-org.el
@@ -253,7 +253,7 @@ variables and the expected link."
 ;; Testing a different drive should stand in for testing
 ;; `hyperdrive-org-link-full-url' as well as insertion in
 ;; non-hyperdrive buffers, since all of these cases cause
-;; `hyperdrive--org-insert-link-after-advice' to do nothing.
+;; `hyperdrive-org--insert-link-after-advice' to do nothing.
 
 (hyperdrive-test-org-insert-link-deftest 
org-mode-before-heading/different-drive
   :public-key "fredbeef"
@@ -274,7 +274,7 @@ variables and the expected link."
 ;;;; Parse relative/absolute link into entry tests
 
 ;; Neither full "hyper://"-prefixed URLs, nor links which are only search
-;; options, are handled by `hyperdrive--org-link-entry-at-point'.
+;; options, are handled by `hyperdrive-org--link-entry-at-point'.
 
 (defmacro hyperdrive-org-test-link-parse-deftest (name current-entry link 
parsed-entry)
   (declare (indent defun))
@@ -288,7 +288,7 @@ variables and the expected link."
            (insert ,link)
            (goto-char (point-min))
            (should
-            (hyperdrive-entry-equal-p ,parsed-entry 
(hyperdrive--org-link-entry-at-point))))))))
+            (hyperdrive-entry-equal-p ,parsed-entry 
(hyperdrive-org--link-entry-at-point))))))))
 
 (hyperdrive-org-test-link-parse-deftest absolute/without-search-option
   (hyperdrive-entry-create



reply via email to

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