From 17f85abf207ece51bd37c8f3490d8f7d2fa106d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Fl=C3=BCgge?= Date: Tue, 24 Sep 2024 15:18:42 +0200 Subject: [PATCH] fix: update orgmode db on roam node creation (#64) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To make a new roam node accessible for refiling, searching and agenda the org files need to be loaded again. Co-authored-by: Sebastian Flügge --- lua/org-roam/database/loader.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lua/org-roam/database/loader.lua b/lua/org-roam/database/loader.lua index 46ab506..7182561 100644 --- a/lua/org-roam/database/loader.lua +++ b/lua/org-roam/database/loader.lua @@ -348,6 +348,14 @@ function M:load_file(opts) insert_new_file_into_database(db, file, { force = opts.force or file.metadata.changedtick ~= changedtick, }) + + -- To allow a newly created roam file to be accessible for refiling and other + -- convenience features of orgmode, it must be add to the orgmode database. + -- Although it might be expected, that files:add_to_paths already does that, + -- this is currently not the case. + -- So the next line is a workaround to achieve this goal. Some rework at orgmodes + -- file-loading is to be expected and when it's done, this line can be removed. + require("orgmode").files:add_to_paths(file.filename) end resolve({