branch: externals/denote
commit 451e5009fbd8f37dd0409c48c9720a61795dfd24
Merge: 679c13c5d9 b89d30de21
Author: Protesilaos Stavrou <[email protected]>
Commit: Protesilaos Stavrou <[email protected]>

    Merge branch 'main' of github.com:protesilaos/denote
---
 denote.el | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/denote.el b/denote.el
index 648b943a12..e42c375508 100644
--- a/denote.el
+++ b/denote.el
@@ -6042,17 +6042,11 @@ Also see `denote-get-links'."
               (files (denote-directory-files nil :omit-current :text-only)))
     (catch 'has-backlinks
       (dolist (file files)
-        (when-let* ((file-type (denote-filetype-heuristics file))
-                    (link-regexp (denote--link-in-context-regexp file-type)))
-          (with-temp-buffer
-            (insert-file-contents file)
-            (goto-char (point-min))
-            (while (re-search-forward link-regexp nil t)
-              (when
-                  (string-equal
-                   (caar (denote--inside-link-regexp-p link-regexp (point)))
-                   id)
-                (throw 'has-backlinks t)))))))))
+        (with-temp-buffer
+          (insert-file-contents file)
+          (goto-char (point-min))
+          (when (search-forward (format "[denote:%s]" id) nil t)
+            (throw 'has-backlinks t)))))))
 
 ;;;###autoload
 (defun denote-find-backlink ()

Reply via email to