Skip to content

Commit

Permalink
fix(loader): Fix typo in persisting loaded file
Browse files Browse the repository at this point in the history
  • Loading branch information
kristijanhusak committed Sep 23, 2024
1 parent fd95708 commit 08d763d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lua/orgmode/files/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ function OrgFiles:load_file(filename, opts)

return OrgFile.load(filename):next(function(orgfile)
if orgfile then
persist_if_required(file)
persist_if_required(orgfile)
self.all_files[filename] = orgfile
end
return orgfile
Expand Down
8 changes: 7 additions & 1 deletion tests/plenary/init_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,17 @@ describe('Init', function()
org.files:load_file_sync(fname, { persist = true })
assert.is.Nil(org.files.files[fname])

org.files.all_files[todo_file] = nil
org.files.files[todo_file] = nil

org.files:load_file_sync(todo_file)

-- Not added because persist was not provided
assert.is.Nil(org.files.files[fname])
assert.is.Nil(org.files.files[todo_file])
assert.is.Not.Nil(org.files.all_files[todo_file])

org.files.all_files[todo_file] = nil
org.files.files[todo_file] = nil

org.files:load_file_sync(todo_file, { persist = true })
assert.is.Not.Nil(org.files.files[todo_file])
Expand Down

0 comments on commit 08d763d

Please sign in to comment.