aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYann Herklotz <git@yannherklotz.com>2020-08-16 19:15:38 +0100
committerYann Herklotz <git@yannherklotz.com>2020-08-16 19:15:38 +0100
commit7295961ff1ba95e65319081cefabd2b8b6bf3890 (patch)
tree7dcbc73bda6435f0f5e55c940b9030934fb681bb
parentfe6cc617c9a4b9cc8b05c5f77267c05124d56a56 (diff)
downloademacs-zettelkasten-7295961ff1ba95e65319081cefabd2b8b6bf3890.tar.gz
emacs-zettelkasten-7295961ff1ba95e65319081cefabd2b8b6bf3890.zip
Add function to find notes without parents
-rw-r--r--zettelkasten.el8
1 files changed, 7 insertions, 1 deletions
diff --git a/zettelkasten.el b/zettelkasten.el
index adaf45b..3af8f5c 100644
--- a/zettelkasten.el
+++ b/zettelkasten.el
@@ -289,6 +289,12 @@ If PARENT is nil, it will not add a link from a PARENT."
"Generate a list of links for NOTE."
(zettelkasten--generate-list-for-note-nc (zettelkasten--list-links note)))
+(defun zettelkasten--list-notes-without-parents ()
+ "List all the notes that do not have any parents."
+ (delete nil (mapcar #'(lambda (n)
+ (if (zettelkasten--find-parents n) nil n))
+ (zettelkasten--list-notes-by-id))))
+
(defun zettelkasten-generate-site-map (title files)
"Generate the site map for the Zettelkasten using TITLE and FILES."
(let* ((ti (zettelkasten--get-tags-and-ids))
@@ -304,7 +310,7 @@ If PARENT is nil, it will not add a link from a PARENT."
"\n\n* Index\n\n"
(apply
#'concat
- (zettelkasten--generate-list-for-note-nc (zettelkasten--list-notes-by-id)))
+ (zettelkasten--generate-list-for-note-nc (zettelkasten--list-notes-without-parents)))
"\n* Tags\n\n"
(apply
#'concat