From 6a99051a0bffe5d07ca017142ce98b17c08a65ea Mon Sep 17 00:00:00 2001 From: Yann Herklotz Date: Sat, 24 Dec 2022 15:03:59 +0000 Subject: Allow creating heading in the middle of a note --- org-zettelkasten.el | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/org-zettelkasten.el b/org-zettelkasten.el index 64a71b2..4d18dcc 100644 --- a/org-zettelkasten.el +++ b/org-zettelkasten.el @@ -79,7 +79,7 @@ ends with a letter." (concat ident "1"))) (defun org-zettelkasten-org-zettelkasten-create (incr newheading) - "Creat a new heading according to INCR and NEWHEADING. + "Create a new heading according to INCR and NEWHEADING. INCR: function to increment the ID by. NEWHEADING: function used to create the heading and set the current @@ -93,12 +93,16 @@ NEWHEADING: function used to create the heading and set the current (defun org-zettelkasten-create-next () "Create a heading at the same level as the current one." (org-zettelkasten-org-zettelkasten-create - #'org-zettelkasten-incr-id #'org-insert-heading)) + #'org-zettelkasten-incr-id #'org-insert-heading-after-current)) (defun org-zettelkasten-create-branch () "Create a branching heading at a level lower than the current." (org-zettelkasten-org-zettelkasten-create - #'org-zettelkasten-branch-id (lambda () (org-insert-subheading "")))) + #'org-zettelkasten-branch-id + (lambda () + (org-back-to-heading) + (org-forward-heading-same-level 1 t) + (org-insert-subheading "")))) (defun org-zettelkasten-create-dwim () "Create the right type of heading based on current position." -- cgit