branch: externals/denote-sequence
commit 6e2c0828add52d2e976aad87c12aa679bdd16874
Author: Protesilaos Stavrou <[email protected]>
Commit: Protesilaos Stavrou <[email protected]>
Add commands to move to the next or previous sibling
I will document these later...
---
denote-sequence.el | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/denote-sequence.el b/denote-sequence.el
index 0a5588ea41..67b65b193d 100644
--- a/denote-sequence.el
+++ b/denote-sequence.el
@@ -880,6 +880,26 @@ If the current file does not have a sequence, then behave
exactly like
(denote-use-signature new-sequence))
(call-interactively 'denote)))
+;;;###autoload
+(defun denote-sequence-find-next-sibling (sequence)
+ "Visit the next sibling of file with SEQUENCE."
+ (interactive (list (denote-sequence--get-file-in-dired-or-prompt "Make a new
sibling of SEQUENCE")))
+ (if-let* ((relatives (denote-sequence-get-relative sequence 'siblings))
+ (next-sequence (denote-sequence--infer-sibling sequence 'next))
+ (path (denote-sequence-get-path next-sequence relatives)))
+ (find-file path)
+ (user-error "No next sibling for sequence `%s'" sequence)))
+
+;;;###autoload
+(defun denote-sequence-find-previous-sibling (sequence)
+ "Visit the previous sibling of file with SEQUENCE."
+ (interactive (list (denote-sequence--get-file-in-dired-or-prompt "Make a new
sibling of SEQUENCE")))
+ (if-let* ((relatives (denote-sequence-get-relative sequence 'siblings))
+ (previous-sequence (denote-sequence--infer-sibling sequence
'previous))
+ (path (denote-sequence-get-path previous-sequence relatives)))
+ (find-file path)
+ (user-error "No previous sibling for sequence `%s'" sequence)))
+
(defvar denote-sequence-relative-types
'(all-parents parent siblings children all-children)
"Types of sequence relatives.")