[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/denote c6b8526486 2/4: Make denote-link-return-links mo
From: |
ELPA Syncer |
Subject: |
[elpa] externals/denote c6b8526486 2/4: Make denote-link-return-links more efficient and work in silos |
Date: |
Sat, 31 Aug 2024 00:57:46 -0400 (EDT) |
branch: externals/denote
commit c6b8526486431dd97fd666209edd4942a48a8512
Author: Jean-Philippe Gagné Guay <jeanphilippe150@gmail.com>
Commit: Jean-Philippe Gagné Guay <jeanphilippe150@gmail.com>
Make denote-link-return-links more efficient and work in silos
---
denote.el | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/denote.el b/denote.el
index 7b032d0950..e45dc32e9e 100644
--- a/denote.el
+++ b/denote.el
@@ -3989,10 +3989,20 @@ Also see `denote-link-return-backlinks'."
(when-let ((current-file (or file (buffer-file-name)))
((denote-file-has-supported-extension-p current-file))
(file-type (denote-filetype-heuristics current-file))
- (regexp (denote--link-in-context-regexp file-type)))
- (with-temp-buffer
- (insert-file-contents current-file)
- (denote-link--expand-identifiers regexp))))
+ (regexp (denote--link-in-context-regexp file-type))
+ (files (denote-directory-files))
+ (file-identifiers
+ (with-temp-buffer
+ (insert-file-contents current-file)
+ (denote-link--collect-identifiers regexp)))
+ (file-identifiers-hash-table (make-hash-table :test 'equal)))
+ (dolist (id file-identifiers)
+ (puthash id t file-identifiers-hash-table))
+ (let ((found-files))
+ (dolist (file files)
+ (when (gethash (denote-retrieve-filename-identifier file)
file-identifiers-hash-table)
+ (push file found-files)))
+ found-files)))
(defalias 'denote-link-return-forelinks 'denote-link-return-links
"Alias for `denote-link-return-links'.")