Skip to content

Commit

Permalink
Ignore file not found errors when loading org file that is not saved
Browse files Browse the repository at this point in the history
  • Loading branch information
kristijanhusak committed Nov 5, 2023
1 parent d1d6eff commit a202c7b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lua/orgmode/parser/file.lua
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,13 @@ function File.load(path, callback)
local category = vim.fn.fnamemodify(path, ':t:r')
utils.readfile(path):next(vim.schedule_wrap(function(content)
return callback(File.from_content(content, category, path, ext == 'org_archive'))
end))
end)):catch(function(err)
-- Ignore file not found errors
if vim.startswith(err, 'ENOENT') then
return
end
error(err)
end)
end

---@param content table
Expand Down

0 comments on commit a202c7b

Please sign in to comment.