branch: externals/denote-org
commit 289472e1565a31e698183cea8d38e05d27402181
Author: Protesilaos Stavrou <i...@protesilaos.com>
Commit: Protesilaos Stavrou <i...@protesilaos.com>

    Fix save-excursion scope in denote-org-dblock--extract-regexp
    
    Otherwise the 'line-end-position' will not be relative to the 'match-end'.
---
 denote-org.el | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/denote-org.el b/denote-org.el
index 683617554c..64d42c71d3 100644
--- a/denote-org.el
+++ b/denote-org.el
@@ -845,11 +845,12 @@ Used by `org-dblock-update' with PARAMS provided by the 
dynamic block."
 
 (defun denote-org-dblock--extract-regexp (regexp)
   "Extract REGEXP from the buffer and trim it of surrounding spaces."
-  (when-let* ((_ (save-excursion (re-search-forward regexp nil :no-error)))
-              (match-end (match-end 0))
-              (line-end (line-end-position))
-              (text (buffer-substring-no-properties match-end line-end)))
-    (string-trim text)))
+  (save-excursion
+    (when-let* ((_ (re-search-forward regexp nil :no-error))
+                (match-end (match-end 0))
+                (line-end (line-end-position))
+                (text (buffer-substring-no-properties match-end line-end)))
+      (string-trim text))))
 
 (defun denote-org-dblock--get-file-contents-as-heading (file add-links)
   "Insert the contents of Org FILE, formatting the #+title as a heading.

Reply via email to