File tree Expand file tree Collapse file tree 3 files changed +19
-4
lines changed Expand file tree Collapse file tree 3 files changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -69,13 +69,13 @@ function OrgAgendaType:new(opts)
6969 to = nil ,
7070 clock_report = nil ,
7171 show_clock_report = opts .show_clock_report or false ,
72- start_on_weekday = opts .start_on_weekday or config .org_agenda_start_on_weekday ,
73- start_day = opts .start_day or config .org_agenda_start_day ,
72+ start_on_weekday = utils . if_nil ( opts .start_on_weekday , config .org_agenda_start_on_weekday ) ,
73+ start_day = utils . if_nil ( opts .start_day , config .org_agenda_start_day ) ,
7474 agenda_files = opts .agenda_files ,
7575 header = opts .header ,
7676 sorting_strategy = opts .sorting_strategy or vim .tbl_get (config .org_agenda_sorting_strategy , ' agenda' ) or {},
7777 id = opts .id ,
78- remove_tags = type (opts .remove_tags ) == ' boolean ' and opts . remove_tags or config .org_agenda_remove_tags ,
78+ remove_tags = utils . if_nil (opts .remove_tags , config .org_agenda_remove_tags ) ,
7979 }
8080 data .valid_filters = vim .tbl_filter (function (filter )
8181 return filter and true or false
Original file line number Diff line number Diff line change 1313--- @class OrgAgendaCustomCommandAgenda : OrgAgendaCustomCommandTypeInterface
1414--- @field org_agenda_span ? OrgAgendaSpan Default : ' week'
1515--- @field org_agenda_start_day ? string Modifier from today , example ' +1d'
16- --- @field org_agenda_start_on_weekday ? number
16+ --- @field org_agenda_start_on_weekday ? number | false
1717
1818--- @class OrgAgendaCustomCommandTags : OrgAgendaCustomCommandTypeInterface
1919--- @field match ? string
Original file line number Diff line number Diff line change @@ -635,4 +635,19 @@ function utils.notify(msg, opts)
635635 vim .notify (message , vim .log .levels [opts .level :upper ()], opts )
636636end
637637
638+ --- Return first non-nil value
639+ --- @generic T
640+ --- @param ... T
641+ --- @return T
642+ function utils .if_nil (...)
643+ local nargs = select (' #' , ... )
644+ for i = 1 , nargs do
645+ local v = select (i , ... )
646+ if v ~= nil then
647+ return v
648+ end
649+ end
650+ return nil
651+ end
652+
638653return utils
You can’t perform that action at this time.
0 commit comments