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

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

[elpa] externals/denote 9da32a566b: Make dynamic block accept 'rx' notat


From: ELPA Syncer
Subject: [elpa] externals/denote 9da32a566b: Make dynamic block accept 'rx' notation for regexp
Date: Wed, 4 Jan 2023 07:57:39 -0500 (EST)

branch: externals/denote
commit 9da32a566b57e572a6a712b55cfc43aeb5af4b78
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>

    Make dynamic block accept 'rx' notation for regexp
    
    Thanks to Mirko Hernandez for proposing this feature and discussing it
    with me in issue 122 on the GitHub mirror:
    <https://github.com/protesilaos/denote/issues/122>.
---
 README.org           | 11 +++++++----
 denote-org-dblock.el | 15 ++++++++-------
 2 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/README.org b/README.org
index a531ae78b2..00df5e87ef 100644
--- a/README.org
+++ b/README.org
@@ -1713,7 +1713,9 @@ A dynamic block looks like this:
 
 Here we have the =denote-links= type, with the =:regexp= parameter.
 The value of the =:regexp= parameter is the same as that of the
-command ~denote-link-add-links~ 
([[#h:9bec2c83-36ca-4951-aefc-7187c5463f90][Insert links matching a regexp]]).  
The
+command ~denote-link-add-links~ 
([[#h:9bec2c83-36ca-4951-aefc-7187c5463f90][Insert links matching a regexp]]).  
It
+can only use the notation of the ~rx~ macro, as explained in the Emacs
+Lisp Reference Manual (evaluate: =(info "(elisp) Rx Notation")=).  The
 linked entry provides practical examples of patterns that make good
 use of Denote's file-naming scheme 
([[#h:4e9c7512-84dc-4dfb-9fa9-e15d51178e5d][The file-naming scheme]]).
 
@@ -3599,9 +3601,10 @@ Denote is meant to be a collective effort.  Every bit of 
help matters.
   Borrás, Benjamin Kästner, Colin McLear, Damien Cassou, Elias Storms,
   Federico Stilman, Florian, Frank Ehmsen, Guo Yong, Hanspeter Gisler,
   Jack Baty, Jeremy Friesen, Juanjo Presa, Johan Bolmsjö, Kaushal
-  Modi, M. Hadi Timachi, Paul van Gelder, Peter Prevos, Shreyas
-  Ragavan, Stefan Thesing, Summer Emacs, Sven Seebeck, Taoufik, Viktor
-  Haag, Yi Liu, Ypot, atanasj, hpgisler, pRot0ta1p, sienic, sundar bp.
+  Modi, M. Hadi Timachi, Mirko Hernandez, Paul van Gelder, Peter
+  Prevos, Shreyas Ragavan, Stefan Thesing, Summer Emacs, Sven Seebeck,
+  Taoufik, Viktor Haag, Yi Liu, Ypot, atanasj, hpgisler, pRot0ta1p,
+  sienic, sundar bp.
 
 Special thanks to Peter Povinec who helped refine the file-naming
 scheme, which is the cornerstone of this project.
diff --git a/denote-org-dblock.el b/denote-org-dblock.el
index 6ef7dd94e8..a55cdd783c 100644
--- a/denote-org-dblock.el
+++ b/denote-org-dblock.el
@@ -102,19 +102,20 @@
 (defun org-dblock-write:denote-links (params)
   "Function to update `denote-links' Org Dynamic blocks.
 Used by `org-dblock-update' with PARAMS provided by the dynamic block."
-  (let ((regexp (plist-get params :regexp))
-        (missing-only (plist-get params :missing-only))
-        (block-name (plist-get params :block-name))
-        (denote-link-add-links-sort (plist-get params :reverse))
-        (current-file (buffer-file-name)))
+  (let* ((regexp (plist-get params :regexp))
+         (rx (if (listp regexp) (macroexpand `(rx ,regexp)) regexp))
+         (missing-only (plist-get params :missing-only))
+         (block-name (plist-get params :block-name))
+         (denote-link-add-links-sort (plist-get params :reverse))
+         (current-file (buffer-file-name)))
     (when block-name
       (insert "#+name: " block-name "\n"))
     (if missing-only
         (progn
-          (denote-link-add-missing-links regexp)
+          (denote-link-add-missing-links rx)
           (join-line)) ;; remove trailing empty line left by 
denote-link--prepare-links
       (when-let ((files (delete current-file
-                                (denote-directory-files-matching-regexp 
regexp))))
+                                (denote-directory-files-matching-regexp rx))))
         (insert (denote-link--prepare-links files current-file nil))
         (join-line))))) ;; remove trailing empty line
 



reply via email to

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