branch: externals/denote-org commit 44ecc6b680b1898bca3b8acf78357ba841b18977 Author: Protesilaos Stavrou <i...@protesilaos.com> Commit: Protesilaos Stavrou <i...@protesilaos.com>
Make org-dblock-write:denote-sequence return nil if appropriate --- denote-org.el | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/denote-org.el b/denote-org.el index 010d3e911f..dff61517d4 100644 --- a/denote-org.el +++ b/denote-org.el @@ -1026,19 +1026,17 @@ If sequence does not start with a =, then include it." When sequence is an empty string, then use all Denote files with a sequence. Used by `org-dblock-update' with PARAMS provided by the dynamic block." - (let* ((block-name (plist-get params :block-name)) - (sequence (plist-get params :sequence)) - (depth (plist-get params :depth)) - (parent-regexp (denote-org-sequence--format-word-regexp sequence)) - (parent (denote-directory-files parent-regexp)) - (children (denote-sequence-get-relative sequence 'all-children)) - (family (if children - (append parent children) - (denote-sequence-get-all-files))) - (files (denote-org-sequence--get-files-with-max-depth depth family))) + (when-let* ((block-name (plist-get params :block-name)) + (sequence (plist-get params :sequence)) + (depth (plist-get params :depth)) + (parent-regexp (denote-org-sequence--format-word-regexp sequence)) + (parent (denote-directory-files parent-regexp)) + (children (denote-sequence-get-relative sequence 'all-children)) + (family (append parent children)) + (files (denote-org-sequence--get-files-with-max-depth depth family))) (when block-name (insert "#+name: " block-name "\n")) (denote-org--insert-sequence files) - (join-line))) + (join-line)))) ;; NOTE 2024-03-30: This is how the autoload is done in org.el. ;;;###autoload