branch: externals/denote
commit 6f1773a9b78b71eac37ca4d54cede4842eb06eb8
Author: Alexandre Rousseau <yal...@gmail.com>
Commit: Alexandre Rousseau <yal...@gmail.com>

    File link conversion tracks the value of org-link-file-path-type
---
 denote-org-extras.el | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/denote-org-extras.el b/denote-org-extras.el
index d6df935e32..d7c9edb40a 100644
--- a/denote-org-extras.el
+++ b/denote-org-extras.el
@@ -240,6 +240,15 @@ description."
       (_ (error "`%s' is an unknown link type" type)))
     (format 
"\\[\\[\\(?1:%s:\\)\\(?:\\(?2:.*?\\)\\(?3:::.*\\)?\\]\\|\\]\\)\\(?4:\\[\\(?:.*?\\)\\]\\)?\\]"
 group-1)))
 
+;;;###autoload
+(defun denote-org-extras-get-path-by-id (id)
+  "Return the path, relative or absolute, as indicated by
+org-link-file-path-type, to the denote file matching id."
+  (if (or (eql org-link-file-path-type 'adaptive)
+          (eql org-link-file-path-type 'relative))
+      (denote-get-relative-path-by-id id)
+    (denote-get-path-by-id id)))
+
 ;;;###autoload
 (defun denote-org-extras-convert-links-to-file-type ()
   "Convert denote: links to file: links in the current Org buffer.
@@ -253,7 +262,7 @@ resolve to a file in the variable `denote-directory'."
           (let* ((id (match-string-no-properties 2))
                  (search (or (match-string-no-properties 3) ""))
                  (desc (or (match-string-no-properties 4) ""))
-                 (file (save-match-data (denote-get-path-by-id id))))
+                 (file (save-match-data (denote-org-extras-get-path-by-id 
id))))
             (when id
               (let ((new-text (if desc
                                   (format "[[file:%s%s]%s]" file search desc)

Reply via email to