branch: externals/denote
commit b6e8701f29a7f20963f69f82c80ed95f5069e264
Author: Protesilaos Stavrou <i...@protesilaos.com>
Commit: Protesilaos Stavrou <i...@protesilaos.com>

    Make denote--link-in-context-regexp always check for ID-only links as well
    
    This is because a file may have both.
---
 denote.el | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/denote.el b/denote.el
index a9788bc9dc..8a42a870e1 100644
--- a/denote.el
+++ b/denote.el
@@ -2221,14 +2221,16 @@ this list for new note creation.  The default is 
`org'.")
         (symbol-value prop)
       prop)))
 
+(defvar denote-id-only-link-in-context-regexp)
+
 (defun denote--link-in-context-regexp (file-type)
   "Return link regexp in context based on FILE-TYPE."
-  (let ((prop (plist-get
-               (alist-get file-type denote-file-types)
-               :link-in-context-regexp)))
-    (if (symbolp prop)
-        (symbol-value prop)
-      prop)))
+  (when-let* ((type (alist-get file-type denote-file-types))
+              (property (plist-get type :link-in-context-regexp))
+              (link-type-regexp (if (symbolp property)
+                                    (symbol-value property)
+                                  property)))
+    (format "%s\\|%s" link-type-regexp denote-id-only-link-in-context-regexp)))
 
 (defun denote-file-type-extensions ()
   "Return all file type extensions in `denote-file-types'."
@@ -4918,8 +4920,7 @@ the active region specially, is up to it."
   (let (matches)
     (save-excursion
       (goto-char (point-min))
-      (while (or (re-search-forward regexp nil t)
-                 (re-search-forward denote-id-only-link-in-context-regexp nil 
t))
+      (while (re-search-forward regexp nil t)
         (push (match-string-no-properties 1) matches)))
     matches))
 

Reply via email to