branch: externals/denote-org commit 3f9b0d6c8de31caf520c5fc5c5ceb05e86ac6689 Author: Peter Prevos <pe...@prevos.net> Commit: Peter Prevos <pe...@prevos.net>
Handle empty sequence case in file retrieval Ensure that the function can manage cases where the sequence is an empty string, avoiding errors when building the family of files. --- denote-org.el | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/denote-org.el b/denote-org.el index 9b2dfc80dc..91c61944c3 100644 --- a/denote-org.el +++ b/denote-org.el @@ -1027,11 +1027,13 @@ 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)) (depth (plist-get params :depth))) - (when-let* ((sequence (plist-get params :sequence)) - (parent (denote-sequence-get-path sequence)) - (children (denote-sequence-get-relative sequence 'all-children)) - (family (push parent children)) - (files (denote-org-sequence--get-files-with-max-depth depth family))) + (let* ((sequence (plist-get params :sequence)) + (parent (denote-sequence-get-path sequence)) + (children (denote-sequence-get-relative sequence 'all-children)) + (family (if (eq sequence "") + nil + (push 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)))))