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

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

[elpa] externals/denote 24a0037d40 12/14: denote-retrieve--search only w


From: ELPA Syncer
Subject: [elpa] externals/denote 24a0037d40 12/14: denote-retrieve--search only works on Denote file types
Date: Sun, 17 Jul 2022 02:57:29 -0400 (EDT)

branch: externals/denote
commit 24a0037d40043af6962692230a74ead99a575ee2
Author: Jean-Philippe Gagné Guay <jeanphilippe150@gmail.com>
Commit: Jean-Philippe Gagné Guay <jeanphilippe150@gmail.com>

    denote-retrieve--search only works on Denote file types
---
 denote-retrieve.el | 27 ++++++++++++++-------------
 1 file changed, 14 insertions(+), 13 deletions(-)

diff --git a/denote-retrieve.el b/denote-retrieve.el
index 7b78b4046a..d9a87c04dc 100644
--- a/denote-retrieve.el
+++ b/denote-retrieve.el
@@ -56,19 +56,20 @@
 (defun denote-retrieve--search (file key-regexp &optional key)
   "Return value of KEY-REGEXP key in current buffer from FILE.
 If optional KEY is non-nil, return the key instead."
-  (with-temp-buffer
-    (insert-file-contents file)
-    (save-excursion
-      (save-restriction
-        (widen)
-        (goto-char (point-min))
-        (when (re-search-forward key-regexp nil t 1)
-          (if key
-              (match-string-no-properties 0)
-            (let ((trims "[ \t\n\r\"']+"))
-              (string-trim
-               (buffer-substring-no-properties (point) (point-at-eol))
-               trims trims))))))))
+  (when (denote--only-note-p file)
+    (with-temp-buffer
+      (insert-file-contents file)
+      (save-excursion
+        (save-restriction
+          (widen)
+          (goto-char (point-min))
+          (when (re-search-forward key-regexp nil t 1)
+            (if key
+                (match-string-no-properties 0)
+              (let ((trims "[ \t\n\r\"']+"))
+                (string-trim
+                 (buffer-substring-no-properties (point) (point-at-eol))
+                 trims trims)))))))))
 
 (defun denote-retrieve--value-title (file &optional key)
   "Return title value from FILE.



reply via email to

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