summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYann Herklotz <git@yannherklotz.com>2022-12-24 15:03:59 +0000
committerYann Herklotz <git@yannherklotz.com>2022-12-24 15:03:59 +0000
commit6a99051a0bffe5d07ca017142ce98b17c08a65ea (patch)
tree019eacdd7d39e71268162483507ff050a380093f
parent047615824246e3d71f0d4f190a4d4c9ba4f4d8e1 (diff)
downloadorg-zettelkasten-6a99051a0bffe5d07ca017142ce98b17c08a65ea.tar.gz
org-zettelkasten-6a99051a0bffe5d07ca017142ce98b17c08a65ea.zip
Allow creating heading in the middle of a note
-rw-r--r--org-zettelkasten.el10
1 files 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."