File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -126,7 +126,7 @@ function Org:setup_autocmds()
126126 end ,
127127 })
128128
129- vim .api .nvim_create_autocmd ({ ' BufNew' }, {
129+ vim .api .nvim_create_autocmd ({ ' BufNew' , ' BufRead ' }, {
130130 pattern = { ' *.org' , ' *.org_archive' },
131131 group = org_augroup ,
132132 callback = function (event )
Original file line number Diff line number Diff line change @@ -29,12 +29,10 @@ function OrgBuffers.get_buffer_by_filename(filename)
2929 return OrgBuffers ._bufs [resolved_filename ]
3030 end
3131
32- -- If filename does not have an org extension, try to find the buf number and return it if filetype is org
33- if not OrgBuffers ._is_valid_file_name (resolved_filename ) then
34- local bufnr = vim .fn .bufnr (resolved_filename )
35- if bufnr > - 1 and vim .bo [bufnr ].filetype == ' org' then
36- return bufnr
37- end
32+ -- Fall back to buffer lookup in case the cache missed an existing org buffer.
33+ local bufnr = vim .fn .bufnr (resolved_filename )
34+ if bufnr > - 1 and vim .bo [bufnr ].filetype == ' org' then
35+ return bufnr
3836 end
3937
4038 return - 1
You can’t perform that action at this time.
0 commit comments