Commit 2374864a14bc

Vincent Demeester <vincent@sbr.pm>
2026-03-24 14:43:40
fix(journelly): place entry under new heading
Used open-line instead of insert to keep point on the blank line inside the new entry. Previously, point landed on the next heading, causing org-capture to append the template to the previous day's entry.
1 parent 09ad187
Changed files (1)
dots
config
emacs
site-lisp
dots/config/emacs/site-lisp/journelly.el
@@ -139,7 +139,11 @@ Creates new entry if today's doesn't exist, or appends to existing."
       (journelly--goto-insert-position)
       (insert (journelly--create-entry-heading) "\n")
       (insert (journelly--create-entry-properties) "\n")
-      (insert "\n")  ;; Blank line for content
+      ;; Leave point on blank line inside the new entry, not at the
+      ;; start of the next heading.  org-capture checks org-at-heading-p
+      ;; to set :target-entry-p; if point lands on the old first entry's
+      ;; heading, the template text gets appended to that entry instead.
+      (open-line 1)
       (point))))
 
 (defun journelly-claude-capture-target ()
@@ -163,7 +167,9 @@ Creates new entry if today's Claude session doesn't exist, or appends."
       (journelly--goto-insert-position)
       (insert (journelly--create-entry-heading "Claude session") "\n")
       (insert (journelly--create-entry-properties t) "\n")  ;; Skip weather for Claude
-      (insert "\n")  ;; Blank line for content
+      ;; Leave point on blank line inside the new entry (see
+      ;; journelly-capture-target for detailed explanation).
+      (open-line 1)
       (point))))
 
 ;;; Interactive Functions