Use public headline fields instead private _section
This commit is contained in:
parent
ef441d038f
commit
da8bcec74d
@ -25,8 +25,8 @@ utils.get_entries = function(opts)
|
||||
local agenda_file = orgmode.load(file_entry.filename)
|
||||
for _, headline in ipairs(agenda_file.headlines) do
|
||||
|
||||
local allowed_depth = opts.max_depth == nil or headline._section.level <= opts.max_depth
|
||||
local allowed_archive = opts.archived or not headline._section:is_archived()
|
||||
local allowed_depth = opts.max_depth == nil or headline.level <= opts.max_depth
|
||||
local allowed_archive = opts.archived or not headline.is_archived
|
||||
if allowed_depth and allowed_archive then
|
||||
local entry = {
|
||||
file = file_entry.file,
|
||||
@ -65,7 +65,7 @@ utils.make_entry = function(opts)
|
||||
if headline then
|
||||
lnum = headline.position.start_line
|
||||
location = string.format('%s:%i', location, lnum)
|
||||
line = string.format('%s %s', string.rep('*', headline._section.level), headline.title)
|
||||
line = string.format('%s %s', string.rep('*', headline.level), headline.title)
|
||||
end
|
||||
|
||||
return {
|
||||
|
@ -30,11 +30,11 @@ return function(opts)
|
||||
local dst_headline = entry.value.headline
|
||||
if dst_headline then
|
||||
-- NOTE: adapted from Capture:refile_to_headline
|
||||
if src_item and src_item.level <= dst_headline._section.level then
|
||||
if src_item and src_item.level <= dst_headline.level then
|
||||
-- Refiling in same file just moves the lines from one position
|
||||
-- to another,so we need to apply demote instantly
|
||||
local is_same_file = dst_file.filename == src_item.root.filename
|
||||
src_lines = src_item:demote(dst_headline._section.level - src_item.level + 1, true, not is_same_file)
|
||||
src_lines = src_item:demote(dst_headline.level - src_item.level + 1, true, not is_same_file)
|
||||
end
|
||||
local refiled = Capture:_refile_to(dst_file.filename, src_lines, src_item, dst_headline.position.end_line)
|
||||
if not refiled then
|
||||
|
Loading…
Reference in New Issue
Block a user