diff --git a/lua/orgmode/api/agenda.lua b/lua/orgmode/api/agenda.lua index fdbdd8000..37bd58cff 100644 --- a/lua/orgmode/api/agenda.lua +++ b/lua/orgmode/api/agenda.lua @@ -20,7 +20,7 @@ local function get_date(date, name) error(('Invalid format for "%s" date in Org Agenda'):format(name)) end -local function get_opts(options) +local function get_shared_opts(options) options = options or {} local opts = {} if options.filters and options.filters ~= '' then @@ -35,6 +35,14 @@ local function get_opts(options) return opts end +local function get_tags_opts(options) + local opts = get_shared_opts(options) + opts.match_query = options.match_query + opts.todo_ignore_scheduled = options.org_agenda_todo_ignore_scheduled + opts.todo_ignore_deadlines = options.org_agenda_todo_ignore_deadlines + return opts +end + ---@class OrgApiAgendaOpts ---@field filters? OrgApiAgendaFilter ---@field header? string @@ -51,7 +59,7 @@ end ---@param options? OrgApiAgendaOptions function OrgAgenda.agenda(options) options = options or {} - local opts = get_opts(options) + local opts = get_shared_opts(options) opts.from = get_date(options.from, 'from') opts.span = options.span orgmode.agenda:agenda(opts) @@ -62,32 +70,31 @@ end ---@param options? OrgApiAgendaTodosOptions function OrgAgenda.todos(options) options = options or {} - local opts = get_opts(options) + local opts = get_shared_opts(options) orgmode.agenda:todos(opts) end ----@class OrgApiAgendaTagsOptions:OrgApiAgendaOpts +---@class OrgApiAgendaTagsTodoOptions:OrgApiAgendaOpts ---@field match_query? string Match query to find the todos ----@field todo_only? boolean +---@field org_agenda_todo_ignore_scheduled? OrgAgendaTodoIgnoreScheduledTypes +---@field org_agenda_todo_ignore_deadlines? OrgAgendaTodoIgnoreDeadlinesTypes ---@param options? OrgApiAgendaTagsOptions -function OrgAgenda.tags(options) +function OrgAgenda.tags_todo(options) options = options or {} - local opts = get_opts(options) - opts.todo_only = options.todo_only - opts.match_query = options.match_query - orgmode.agenda:tags(opts) + local opts = get_tags_opts(options) + orgmode.agenda:tags_todo(opts) end ----@class OrgApiAgendaTagsTodoOptions:OrgApiAgendaOpts ----@field match_query? string Match query to find the todos +---@class OrgApiAgendaTagsOptions:OrgApiAgendaTagsTodoOptions +---@field todo_only? boolean ---@param options? OrgApiAgendaTagsOptions -function OrgAgenda.tags_todo(options) +function OrgAgenda.tags(options) options = options or {} - local opts = get_opts(options) - opts.match_query = options.match_query - orgmode.agenda:tags_todo(opts) + local opts = get_tags_opts(options) + opts.todo_only = options.todo_only + orgmode.agenda:tags(opts) end return OrgAgenda