branch: externals/denote
commit c72e535a04fe931d6339ca1de9c71b696c44f3d3
Author: Protesilaos Stavrou <[email protected]>
Commit: Protesilaos Stavrou <[email protected]>
Make denote-sequence--get-new-parent work if there are no sequences
---
denote-sequence.el | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/denote-sequence.el b/denote-sequence.el
index 92929c545e..388764cd64 100644
--- a/denote-sequence.el
+++ b/denote-sequence.el
@@ -120,11 +120,12 @@ TYPE is a symbol among `denote-sequence-types'."
"Return a new to increment largest among sequences.
With optional SEQUENCES consider only those, otherwise operate on the
return value of `denote-sequence-get-all-sequences'."
- (let* ((all (or sequences (denote-sequence-get-all-sequences)))
- (largest (denote-sequence--get-largest all 'parent))
- (first-component (car (split-string largest "=")))
- (current-number (string-to-number first-component)))
- (number-to-string (+ current-number 1))))
+ (if-let* ((all (or sequences (denote-sequence-get-all-sequences))))
+ (let* ((largest (denote-sequence--get-largest all 'parent))
+ (first-component (car (split-string largest "=")))
+ (current-number (string-to-number first-component)))
+ (number-to-string (+ current-number 1)))
+ "1"))
(defun denote-sequence--get-new-child (sequence &optional sequences)
"Return a new child of SEQUENCE.