File tree Expand file tree Collapse file tree 2 files changed +6
-10
lines changed Expand file tree Collapse file tree 2 files changed +6
-10
lines changed Original file line number Diff line number Diff line change @@ -4,17 +4,14 @@ local entry_display = require('telescope.pickers.entry_display')
4
4
5
5
local M = {}
6
6
7
- --- @param file_results { file : OrgApiFile , filename : string } []
7
+ --- @param file_results { filename : string , title : string , headline : string } []
8
8
--- @return OrgFileEntry[]
9
9
local function index_orgfiles (file_results )
10
10
local results = {}
11
11
for _ , file_entry in ipairs (file_results ) do
12
12
local entry = {
13
- file = file_entry .file ,
14
13
filename = file_entry .filename ,
15
- -- not beautiful to access a private property, but this is the only way to get the title
16
- --- @diagnostic disable-next-line : invisible , undefined-field
17
- title = file_entry .file ._file :get_directive (' TITLE' ) or nil ,
14
+ title = file_entry .title ,
18
15
headline = nil ,
19
16
}
20
17
table.insert (results , entry )
Original file line number Diff line number Diff line change @@ -3,15 +3,14 @@ local OrgApi = require('orgmode.api')
3
3
local M = {}
4
4
5
5
function M .load_files (opts )
6
- --- @type { file : OrgApiFile , filename : string , last_used : number } []
6
+ --- @type { filename : string , last_used : number , title : string } []
7
7
local file_results = vim .tbl_map (function (file )
8
- local file_stat = vim .uv .fs_stat (file .filename ) or 0
9
- return { file = file , filename = file .filename , last_used = file_stat .mtime .sec }
10
- end , OrgApi .load ())
8
+ return { filename = file .filename , last_used = file .metadata .mtime , title = file :get_title () }
9
+ end , require (' orgmode' ).files :all ())
11
10
12
11
if not opts .archived then
13
12
file_results = vim .tbl_filter (function (entry )
14
- return not entry . file . is_archive_file
13
+ return not ( vim . fn . fnamemodify ( entry . filename , ' :e ' ) == ' org_archive ' )
15
14
end , file_results )
16
15
end
17
16
You can’t perform that action at this time.
0 commit comments