Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions doc/orgmode.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1183,6 +1183,31 @@ Additional files to search from agenda search prompt. Currently it accepts only
a single value: `agenda-archives`. Example value: `{'agenda-archives'}`


org_agenda_scheduled_leaders *orgmode-org_agenda_scheduled_leaders*

- Type: `string[]`
- Default: `{'Scheduled:', 'Sched. %dx:'}`

Text preceding scheduled items in the agenda view. This is a list with two
strings. The first applies when the item is scheduled on the current day. The
second applies when it has been scheduled previously, it may contain a %d
indicating that this is the nth time that this item is scheduled, due to
automatic rescheduling of unfinished items for the following day. So this
number is one larger than the number of days that passed since this item was
scheduled first.


org_agenda_deadline_leaders *orgmode-org_agenda_deadline_leaders*

- Type: `string[]`
- Default: `{'Deadline:', 'In %d d.:', "%d d. ago"},`

Text preceding deadline items in the agenda view. This is a list with three
strings. The first applies when the item has its deadline on the current day.
The second applies when the deadline is in the future, the third one when it is
in the past. The strings may contain %d to capture the number of days.


CALENDAR SETTINGS *orgmode-configuration-calendar-settings*

Adjust behavior of the calendar modal (ex:
Expand Down
25 changes: 25 additions & 0 deletions docs/configuration.org
Original file line number Diff line number Diff line change
Expand Up @@ -1120,6 +1120,31 @@ Additional files to search from agenda search prompt.
Currently it accepts only a single value: =agenda-archives=.
Example value: ={'agenda-archives'}=

*** org_agenda_scheduled_leaders
:PROPERTIES:
:CUSTOM_ID: org_agenda_scheduled_leaders
:END:
- Type: =string[]=
- Default: ={'Scheduled:', 'Sched. %dx:'}=
Text preceding scheduled items in the agenda view. This is a list with two
strings. The first applies when the item is scheduled on the current day. The
second applies when it has been scheduled previously, it may contain a %d
indicating that this is the nth time that this item is scheduled, due to
automatic rescheduling of unfinished items for the following day. So this
number is one larger than the number of days that passed since this item was
scheduled first.

*** org_agenda_deadline_leaders
:PROPERTIES:
:CUSTOM_ID: org_agenda_deadline_leaders
:END:
- Type: =string[]=
- Default: ={'Deadline:', 'In %d d.:', "%d d. ago"},=
Text preceding deadline items in the agenda view. This is a list with three
strings. The first applies when the item has its deadline on the current day.
The second applies when the deadline is in the future, the third one when it is
in the past. The strings may contain %d to capture the number of days.

** Calendar settings
:PROPERTIES:
:CUSTOM_ID: calendar-settings
Expand Down
13 changes: 9 additions & 4 deletions lua/orgmode/agenda/agenda_item.lua
Original file line number Diff line number Diff line change
Expand Up @@ -157,19 +157,24 @@ function AgendaItem:_generate_label()
local time = self.headline_date:has_time() and add_padding(self:_format_time(self.headline_date)) or ''
if self.headline_date:is_deadline() then
if self.is_same_day then
return time .. 'Deadline:'
return time .. config.org_agenda_deadline_leaders[1]
end
local diff = self.date:diff(self.headline_date)
if diff < 0 then
return config.org_agenda_deadline_leaders[2]:gsub('%%d', math.abs(diff))
else
return config.org_agenda_deadline_leaders[3]:gsub('%%d', math.abs(diff))
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit unsure how to handle cases where the configuration is incorrect, for example if the user only specifies two values for org_agenda_deadline_leaders? Do we validate the configuration anywhere or should we add a check here before using them (with a fallback if it's incorrect)? Or just assume the user knows how to configure it properly :).

end
return self.headline_date:humanize(self.date) .. ':'
end

if self.headline_date:is_scheduled() then
if self.is_same_day then
return time .. 'Scheduled:'
return time .. config.org_agenda_scheduled_leaders[1]
end

local diff = math.abs(self.date:diff(self.headline_date))

return 'Sched. ' .. diff .. 'x:'
return config.org_agenda_scheduled_leaders[2]:gsub('%%d', diff)
end

if self.headline_date.is_date_range_start then
Expand Down
2 changes: 2 additions & 0 deletions lua/orgmode/config/_meta.lua
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,8 @@
---@field org_agenda_remove_tags? boolean If true, tags will be removed from the all agenda views. Default: false
---@field org_agenda_use_time_grid? boolean If true, Render time grid in agenda as set by org_agenda_time_grid. Default: true
---@field org_agenda_show_future_repeats? boolean | 'next' If true, show all future repeats. If `next`, show only next repeat. If false, do hnot show any repeats. Default: true
---@field org_agenda_scheduled_leaders? string[] Text preceding scheduled items in the agenda view. This is a list with two strings: the first applies when the item is scheduled on the current day, the second applies when it has been scheduled previously. Default: { 'Scheduled:', 'Sched. %dx:' }
---@field org_agenda_deadline_leaders? string[] Text preceding deadline items in the agenda view. This is a list with three strings. The first applies when the item has its deadline on the current day. The second applies when the deadline is in the future, the third one when it is in the past. Default: {'Deadline:', 'In %d d.:', "%d d. ago"}
---@field org_agenda_time_grid? OrgAgendaTimeGridOpts Agenda time grid configuration. Default: { type = { 'daily', 'today', 'require-timed' }, times = { 800, 1000, 1200, 1400, 1600, 1800, 2000 }, time_separator = '┄┄┄┄┄', time_label = '┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄' }
---@field org_agenda_current_time_string? string String to indicate current time on the time grid. Default: '<- now -----------------------------------------------'
---@field org_priority_highest? string | number Highest priority level. Default: 'A'
Expand Down
2 changes: 2 additions & 0 deletions lua/orgmode/config/defaults.lua
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ local DefaultConfig = {
org_agenda_current_time_string = '<- now -----------------------------------------------',
org_agenda_use_time_grid = true,
org_agenda_show_future_repeats = true,
org_agenda_scheduled_leaders = { 'Scheduled:', 'Sched. %dx:' },
org_agenda_deadline_leaders = { 'Deadline:', 'In %d d.:', '%d d. ago:' },
org_priority_highest = 'A',
org_priority_default = 'B',
org_priority_lowest = 'C',
Expand Down
Loading