From 1da1b465d6c169df57cb2e5f5c26b08c620a469b Mon Sep 17 00:00:00 2001 From: Yann Herklotz Date: Sun, 15 Mar 2020 19:41:35 +0000 Subject: Make parent optional --- zettelkasten.el | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/zettelkasten.el b/zettelkasten.el index 0bcaac1..6e96c30 100644 --- a/zettelkasten.el +++ b/zettelkasten.el @@ -127,7 +127,6 @@ For supported options, please consult `format-time-string'." "Create the new note name." (zettelkasten-find-new-note-name (format-time-string zettelkasten-file-format))) -(zettelkasten-generate-note-name) (defun zettelkasten-get-id (note) "Return the id for a NOTE." @@ -142,16 +141,16 @@ For supported options, please consult `format-time-string'." zettelkasten-extension)) (defun zettelkasten-add-link-to-parent (note parent) - "Add a link to NOTE from PARENT." + "Add a link to NOTE from a PARENT." (with-temp-file (zettelkasten-make-filename parent) (insert-file-contents-literally (zettelkasten-make-filename parent)) (goto-char (point-max)) (insert (concat "\n" (zettelkasten-format-link note))))) -(defun zettelkasten-create-new-note-ni (title parent) - "Create a new note based on the TITLE and it's PARENT note. +(defun zettelkasten-create-new-note-ni (title &optional parent) + "Create a new note based on the TITLE and it's optional PARENT note. -If PARENT is nil, it will not add a link from a parent." +If PARENT is nil, it will not add a link from a PARENT." (let ((note (zettelkasten-generate-note-name))) (when parent (zettelkasten-add-link-to-parent note (zettelkasten-get-id parent))) -- cgit