Fix: roam_refs now go in PROPERTIES at top of node

This commit is contained in:
Willem van den Ende
2026-02-08 21:30:41 +00:00
parent 9c84faa6aa
commit 717c358ce3
@@ -29,10 +29,19 @@
:heading heading
:url url-line)))
(defun my/journelly-add-properties (url journelly-heading)
"Add ROAM_REFS and JOURNELLY_TITLE to the current node's property drawer."
(org-with-point-at 1
(when url
(org-roam-property-add "ROAM_REFS" url))
(when journelly-heading
(org-roam-property-add "JOURNELLY_TITLE" journelly-heading))))
(defun journelly-convert-entry-to-org-roam ()
"Interactive function to convert journelly entry to org-roam.
Opens the capture buffer for review before finalizing."
Opens the capture buffer, adds url as ROAM_REFS
and then lets you review before finalizing."
(interactive)
(let* ((entry-text (if (use-region-p)
(buffer-substring-no-properties (region-beginning) (region-end))
@@ -41,23 +50,20 @@ Opens the capture buffer for review before finalizing."
(title (journelly-entry-title parsed))
(content (journelly-entry-content parsed))
(heading (journelly-entry-heading parsed))
(url (journelly-entry-url parsed)))
;; Build the initial content without ID (org-roam will add it)
(let ((initial-content
(concat
(or content "") "\n")))
(url (journelly-entry-url parsed))
(body (concat (or content "") "\n")))
(org-roam-capture-
:node (org-roam-node-create :title title)
:props (list :immediate-finish nil
:jump-to-captured t)
:templates `(("d" "default" plain
,initial-content
,body
:target (file+head "%<%Y%m%d%H%M%S>-${slug}.org"
,(concat "\n"
(when url (concat "#+roam_refs: " url "\n"))
(when heading (concat "#+journelly_heading: " heading "\n"))
"\n#+title: ${title}\n" ))
:unnarrowed t))))))
"#+title: ${title}\n")
:unnarrowed t)))
(my/journelly-add-properties url heading)))
(ert-deftest test-journelly-parse-basic ()
(let* ((entry " * [2025-10-08 Wed 22:39] @ -
Paul is #XP