From 41ac6ca98c3ac1ddb006df5b55ad8e4dfce6cbb5 Mon Sep 17 00:00:00 2001 From: Willem van den Ende Date: Sat, 11 Oct 2025 14:59:08 +0100 Subject: [PATCH] capture buffer for journelly entries --- mostalive/convert-journelly-to-org-roam.el | 33 ++++++++++++++++------ 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/mostalive/convert-journelly-to-org-roam.el b/mostalive/convert-journelly-to-org-roam.el index 106f88d..24b42d0 100644 --- a/mostalive/convert-journelly-to-org-roam.el +++ b/mostalive/convert-journelly-to-org-roam.el @@ -29,18 +29,35 @@ (defun journelly-convert-entry () - "Interactive function to convert journelly entry to org-roam." + "Interactive function to convert journelly entry to org-roam. +Opens the capture buffer for review before finalizing." (interactive) (let* ((entry-text (if (use-region-p) (buffer-substring-no-properties (region-beginning) (region-end)) (buffer-substring-no-properties (point-min) (point-max)))) - (parsed (journelly-parse-entry entry-text))) - (org-roam-capture- - :node (org-roam-node-create :title (journelly-entry-title parsed)) - :props `(:immediate-finish t - :journelly-heading ,(journelly-entry-heading parsed) - :journelly-url ,(journelly-entry-url parsed) - :journelly-content ,(journelly-entry-content parsed))))) + (parsed (journelly-parse-entry entry-text)) + (title (journelly-entry-title parsed)) + (content (journelly-entry-content parsed)) + (heading (journelly-entry-heading parsed)) + (url (journelly-entry-url parsed))) + ;; Build the initial content + (let ((initial-content + (concat + ":PROPERTIES:\n" + ":ID: " (org-id-new) "\n" + (when url (concat ":ROAM_REFS: " url "\n")) + (when heading (concat ":JOURNELLY_HEADING: " heading "\n")) + ":END:\n" + "#+title: " title "\n\n" + (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 + :target (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "") + :unnarrowed t)))))) (ert-deftest test-journelly-parse-basic () (let* ((entry " * [2025-10-08 Wed 22:39] @ -