Skip to content

Commit 61c0801

Browse files
Make sure file is up to date when parsed.
1 parent 7e0bd5f commit 61c0801

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

lua/orgmode/parser/files.lua

+4-7
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,11 @@ function Files.filenames()
9898
end
9999

100100
---@param file string
101-
---@param refresh boolean
102101
---@return File
103-
function Files.get(file, refresh)
102+
function Files.get(file)
104103
local f = Files.orgfiles[file]
105104
if f then
106-
if refresh then
107-
Files._set_loaded_file(file, f:refresh())
108-
end
105+
Files._set_loaded_file(file, f:refresh())
109106
return Files.orgfiles[file]
110107
end
111108
return nil
@@ -123,7 +120,7 @@ function Files.get_current_file()
123120
if has_capture_var and is_capture then
124121
return File.from_content(vim.api.nvim_buf_get_lines(0, 0, -1, false))
125122
end
126-
return Files.get(name, true)
123+
return Files.get(name)
127124
end
128125

129126
---@param title string
@@ -245,7 +242,7 @@ function Files.get_headline_by_id(id)
245242
if #parts ~= 2 then
246243
return nil
247244
end
248-
local file = Files.get(parts[1], true)
245+
local file = Files.get(parts[1])
249246
if file then
250247
return file:get_closest_headline(tonumber(parts[2]))
251248
end

tests/plenary/ui/helpers.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ local Files = require('orgmode.parser.files')
22
local function load_file(path)
33
vim.cmd(string.format('e %s', path))
44
vim.wait(5000, function()
5-
return Files.get(path, true) ~= nil
5+
return Files.get(path) ~= nil
66
end, 5)
77
vim.cmd(string.format('e %s', path))
88
return path

0 commit comments

Comments
 (0)