Skip to content

Commit da8bcec

Browse files
committed
Use public headline fields instead private _section
1 parent ef441d0 commit da8bcec

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

lua/telescope-orgmode/utils.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ utils.get_entries = function(opts)
2525
local agenda_file = orgmode.load(file_entry.filename)
2626
for _, headline in ipairs(agenda_file.headlines) do
2727

28-
local allowed_depth = opts.max_depth == nil or headline._section.level <= opts.max_depth
29-
local allowed_archive = opts.archived or not headline._section:is_archived()
28+
local allowed_depth = opts.max_depth == nil or headline.level <= opts.max_depth
29+
local allowed_archive = opts.archived or not headline.is_archived
3030
if allowed_depth and allowed_archive then
3131
local entry = {
3232
file = file_entry.file,
@@ -65,7 +65,7 @@ utils.make_entry = function(opts)
6565
if headline then
6666
lnum = headline.position.start_line
6767
location = string.format('%s:%i', location, lnum)
68-
line = string.format('%s %s', string.rep('*', headline._section.level), headline.title)
68+
line = string.format('%s %s', string.rep('*', headline.level), headline.title)
6969
end
7070

7171
return {

lua/telescope/_extensions/orgmode/refile_heading.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ return function(opts)
3030
local dst_headline = entry.value.headline
3131
if dst_headline then
3232
-- NOTE: adapted from Capture:refile_to_headline
33-
if src_item and src_item.level <= dst_headline._section.level then
33+
if src_item and src_item.level <= dst_headline.level then
3434
-- Refiling in same file just moves the lines from one position
3535
-- to another,so we need to apply demote instantly
3636
local is_same_file = dst_file.filename == src_item.root.filename
37-
src_lines = src_item:demote(dst_headline._section.level - src_item.level + 1, true, not is_same_file)
37+
src_lines = src_item:demote(dst_headline.level - src_item.level + 1, true, not is_same_file)
3838
end
3939
local refiled = Capture:_refile_to(dst_file.filename, src_lines, src_item, dst_headline.position.end_line)
4040
if not refiled then

0 commit comments

Comments
 (0)