[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/denote de786b5e8f 9/9: Define helper function to parse
From: |
ELPA Syncer |
Subject: |
[elpa] externals/denote de786b5e8f 9/9: Define helper function to parse rx |
Date: |
Wed, 4 Dec 2024 09:58:05 -0500 (EST) |
branch: externals/denote
commit de786b5e8f9c9f768de44d40e7c951a6ebec0611
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>
Define helper function to parse rx
This has the benefit of extending support for the 'rx' syntax to the
:not-regexp parameter. In principle, this syntax should be available
for all user-facing regular expressions of the dblocks.
---
denote-org-extras.el | 28 +++++++++++++++++-----------
1 file changed, 17 insertions(+), 11 deletions(-)
diff --git a/denote-org-extras.el b/denote-org-extras.el
index f0dcb51742..41c60284ac 100644
--- a/denote-org-extras.el
+++ b/denote-org-extras.el
@@ -421,13 +421,22 @@ Also see `denote-org-extras-dblock--files'."
'(progn
(org-dynamic-block-define "denote-links"
'denote-org-extras-dblock-insert-links)))
+;; TODO 2024-12-04: Maybe we can do this for anything that deals with
+;; regular expressions that users provide? I prefer not to do the
+;; work if nobody wants it, though I am mentioning this here just in
+;; case.
+(defun denote-org-extras--parse-rx (regexp)
+ "Parse REGEXP as an `rx' argument or string and return string."
+ (if (listp regexp)
+ (macroexpand `(rx ,regexp))
+ regexp))
+
;;;###autoload
(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))
- (rx (if (listp regexp) (macroexpand `(rx ,regexp)) regexp))
- (not-rx (plist-get params :not-regexp))
+ (let* ((rx (denote-org-extras--parse-rx (plist-get params :regexp)))
+ (not-rx (denote-org-extras--parse-rx (plist-get params :not-regexp)))
(sort (plist-get params :sort-by-component))
(reverse (plist-get params :reverse-sort))
(include-date (plist-get params :include-date))
@@ -471,8 +480,7 @@ Used by `org-dblock-update' with PARAMS provided by the
dynamic block."
(defun org-dblock-write:denote-missing-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))
- (rx (if (listp regexp) (macroexpand `(rx ,regexp)) regexp))
+ (let* ((rx (denote-org-extras--parse-rx (plist-get params :regexp)))
(sort (plist-get params :sort-by-component))
(reverse (plist-get params :reverse-sort))
(include-date (plist-get params :include-date))
@@ -649,9 +657,8 @@ among `denote-sort-components'."
(defun org-dblock-write:denote-files (params)
"Function to update `denote-files' Org Dynamic blocks.
Used by `org-dblock-update' with PARAMS provided by the dynamic block."
- (let* ((regexp (plist-get params :regexp))
- (rx (if (listp regexp) (macroexpand `(rx ,regexp)) regexp))
- (not-rx (plist-get params :not-regexp))
+ (let* ((rx (denote-org-extras--parse-rx (plist-get params :regexp)))
+ (not-rx (denote-org-extras--parse-rx (plist-get params :not-regexp)))
(sort (plist-get params :sort-by-component))
(reverse (plist-get params :reverse-sort))
(block-name (plist-get params :block-name))
@@ -766,9 +773,8 @@ as its own heading."
(defun org-dblock-write:denote-files-as-headings (params)
"Function to update `denote-files' Org Dynamic blocks.
Used by `org-dblock-update' with PARAMS provided by the dynamic block."
- (let* ((regexp (plist-get params :regexp))
- (rx (if (listp regexp) (macroexpand `(rx ,regexp)) regexp))
- (not-rx (plist-get params :not-regexp))
+ (let* ((rx (denote-org-extras--parse-rx (plist-get params :regexp)))
+ (not-rx (denote-org-extras--parse-rx (plist-get params :not-regexp)))
(sort (plist-get params :sort-by-component))
(reverse (plist-get params :reverse-sort))
(block-name (plist-get params :block-name))
- [elpa] externals/denote updated (7f4a66d802 -> de786b5e8f), ELPA Syncer, 2024/12/04
- [elpa] externals/denote 4205708b2c 3/9: Document in the manual denote-sort-dired-extra-prompts new exclude-regexp symbol, ELPA Syncer, 2024/12/04
- [elpa] externals/denote d6b3269a17 8/9: Merge branch 'not-regexp', ELPA Syncer, 2024/12/04
- [elpa] externals/denote 663e6e0206 2/9: Document denote-directory-files EXCLUDE-REGEXP in the manual, ELPA Syncer, 2024/12/04
- [elpa] externals/denote a701764b0e 1/9: Start implementing not-regexp feature to exclude those files, ELPA Syncer, 2024/12/04
- [elpa] externals/denote 821095844c 4/9: Clarify the wording about default behaviour of denote-sort-dired command, ELPA Syncer, 2024/12/04
- [elpa] externals/denote 89a6f7c8c2 5/9: Fix bug to make denote-sort-dired exclude files matching regexp (see a701764), ELPA Syncer, 2024/12/04
- [elpa] externals/denote a703f2b686 6/9: Implement WORK-IN-PROGRESS support for :not-regexp to omit files in Org dynamic blocks, ELPA Syncer, 2024/12/04
- [elpa] externals/denote fba0bb2650 7/9: Document the :not-regexp parameter of the Org dynamic blocks, ELPA Syncer, 2024/12/04
- [elpa] externals/denote de786b5e8f 9/9: Define helper function to parse rx,
ELPA Syncer <=