Skip to content

Commit

Permalink
fix: update orgmode db on roam node creation (#64)
Browse files Browse the repository at this point in the history
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 <sebastian.fluegge@dnv.com>
  • Loading branch information
seflue and Sebastian Flügge authored Sep 24, 2024
1 parent 192732a commit 17f85ab
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lua/org-roam/database/loader.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down

0 comments on commit 17f85ab

Please sign in to comment.