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

    Make sequence depth accept nil value
---
 README.org    | 18 ++++++++----------
 denote-org.el |  6 +++---
 2 files changed, 11 insertions(+), 13 deletions(-)

diff --git a/README.org b/README.org
index d8f9496e3a..91d9c31261 100644
--- a/README.org
+++ b/README.org
@@ -470,20 +470,18 @@ following in an Org file:
 :
 : #+END:
 
-Both parameters are required.
+The =:sequence= is required, while =:depth= is optional.
 
 - The sequence is the root of the hierarchy displayed in the dynamic
-  block.
+  block. It consists of the text of the sequence, whose numeric format
+  is like ~1=1~ or, for its alphanumeric counterpart, =1a=.
 
-- The depth is the relative depth from the root note. So in the
-  example above, the notes with sequence ~1=1=1~ and ~1=1=2~ will be
-  included in the list, but not ~1=1=2=1~.
+- The depth is the relative depth from the root note: the number 2 is
+  for the children of the given sequence, 3 for grandchildren, and so
+  on. A value of ~nil~ means to find all descendants of the given
+  sequence.
 
-- The list of links Links is indented to visualise their hierarchical
-  structure.
-
-- When the sequence is an empty string, all notes with sequences are
-  included in the list, up to the specified depth.
+The list of links is indented to visualise their hierarchical structure.
 
 * Create a note from the current Org subtree
 :PROPERTIES:
diff --git a/denote-org.el b/denote-org.el
index 575935bcba..37021a3230 100644
--- a/denote-org.el
+++ b/denote-org.el
@@ -993,7 +993,7 @@ With optional FILES operate on them, otherwise use the 
return value of
         (dolist (file sorted-files)
           (let* ((sequence (denote-retrieve-filename-signature file))
                  (depth (denote-sequence-depth sequence)))
-            (when (<= depth (- (+ root-depth max-depth) 1))
+            (when (<= depth (- (+ root-depth (or max-depth 
most-positive-fixnum)) 1))
               (push file hierarchy))))
         (nreverse hierarchy))))
 
@@ -1025,9 +1025,9 @@ With optional FILES operate on them, otherwise use the 
return value of
 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)))
+    (let ((block-name (plist-get params :block-name))
+          (depth (plist-get params :depth)))
       (when-let* ((sequence (plist-get params :sequence))
-                  (depth (plist-get params :depth))
                   (parent (denote-sequence-get-path sequence))
                   (children (denote-sequence-get-relative sequence 
'all-children))
                   (family (push parent children))

Reply via email to