File tree 2 files changed +2
-34
lines changed
2 files changed +2
-34
lines changed Original file line number Diff line number Diff line change 59
59
--- @param filename string
60
60
--- @return OrgPromise<OrgFile | false>
61
61
function OrgFiles :add_to_paths (filename )
62
- filename = vim .fn .resolve (vim .fn .fnamemodify (filename , ' :p' ))
63
-
64
- if self .files [filename ] then
65
- return self .files [filename ]:reload ()
66
- end
67
-
68
- return self :load_file (filename ):next (function (orgfile )
69
- if orgfile then
70
- self .files [filename ] = orgfile
71
- local all_paths = self :_files ()
72
- if not vim .tbl_contains (all_paths , filename ) then
73
- table.insert (self .paths , filename )
74
- end
75
- end
76
- return orgfile
77
- end )
62
+ return self :load_file (filename , { persist = true })
78
63
end
79
64
65
+ --- @deprecated Use `load_file_sync` with `persist` option instead
80
66
--- @param filename string
81
67
--- @param timeout ? number
82
68
--- @return OrgFile | false
Original file line number Diff line number Diff line change @@ -58,24 +58,6 @@ describe('Init', function()
58
58
assert .is .Not .Nil (org .files .files [todo_file ])
59
59
end )
60
60
61
- it (' should append files to paths' , function ()
62
- local fname = vim .fn .resolve (vim .fn .tempname () .. ' .org' )
63
- vim .fn .writefile ({ ' * Appended' }, fname )
64
-
65
- assert .is .Nil (org .files .files [fname ])
66
- assert .are .same ({}, org .files :find_headlines_by_title (' Appended' ))
67
- assert .are .same ({ vim .fn .getcwd () .. ' /tests/plenary/fixtures/*' }, org .files .paths )
68
-
69
- org .files :add_to_paths_sync (fname )
70
- assert .is .Not .Nil (org .files .files [fname ])
71
- assert .are .same (' Appended' , org .files :find_headlines_by_title (' Appended' )[1 ]:get_title ())
72
- assert .are .same ({ vim .fn .getcwd () .. ' /tests/plenary/fixtures/*' , fname }, org .files .paths )
73
-
74
- org .files :add_to_paths_sync (todo_file )
75
- -- Existing file in path not appended to paths
76
- assert .are .same ({ vim .fn .getcwd () .. ' /tests/plenary/fixtures/*' , fname }, org .files .paths )
77
- end )
78
-
79
61
it (' should load a file as org file if it has correct filetype' , function ()
80
62
local fname = vim .fn .resolve (vim .fn .tempname () .. ' .txt' )
81
63
You can’t perform that action at this time.
0 commit comments