Skip to content

Commit e4deea1

Browse files
Add option to change todo state directly from agenda view. Closes #62.
1 parent 1248d78 commit e4deea1

File tree

10 files changed

+157
-163
lines changed

10 files changed

+157
-163
lines changed

DOCS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,9 @@ Open calendar that allows selecting date to jump to
407407
#### **org_agenda_redo**
408408
*mapped to*: `r`<br />
409409
Reload all org files and refresh current agenda view
410+
#### **org_agenda_todo**
411+
*mapped to*: `t`<br />
412+
Change `TODO` state of an item in both agenda and original Org file
410413
#### **org_agenda_show_help**
411414
*mapped to*: `?`<br />
412415
Show help popup with mappings

doc/orgmode.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ CONTENTS *orgmode-content
5151
1.2.2.10. org_agenda_goto....................|orgmode-org_agenda_goto|
5252
1.2.2.11. org_agenda_goto_date..........|orgmode-org_agenda_goto_date|
5353
1.2.2.12. org_agenda_redo....................|orgmode-org_agenda_redo|
54-
1.2.2.13. org_agenda_show_help..........|orgmode-org_agenda_show_help|
54+
1.2.2.13. org_agenda_todo....................|orgmode-org_agenda_todo|
55+
1.2.2.14. org_agenda_show_help..........|orgmode-org_agenda_show_help|
5556
1.2.3. Capture mappings.........................|orgmode-capture_mappings|
5657
1.2.3.1. org_capture_finalize...........|orgmode-org_capture_finalize|
5758
1.2.3.2. org_capture_refile...............|orgmode-org_capture_refile|
@@ -554,6 +555,11 @@ ORG_AGENDA_REDO *orgmode-org_agenda_red
554555
mapped to: `r`
555556
Reload all org files and refresh current agenda view
556557

558+
ORG_AGENDA_TODO *orgmode-org_agenda_todo*
559+
560+
mapped to: `t`
561+
Change `TODO` state of an item in both agenda and original Org file
562+
557563
ORG_AGENDA_SHOW_HELP *orgmode-org_agenda_show_help*
558564

559565
mapped to: `?`

lua/orgmode/agenda/agenda_item.lua

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@ function AgendaItem:new(headline_date, headline, date)
4343
return opts
4444
end
4545

46+
---@param headline Headline
47+
function AgendaItem:set_headline(headline)
48+
self.headline = headline
49+
if self.is_valid then
50+
self:_generate_data()
51+
end
52+
end
53+
4654
function AgendaItem:_process()
4755
if self.is_today then
4856
self.is_valid = self:_is_valid_for_today()
@@ -51,13 +59,18 @@ function AgendaItem:_process()
5159
end
5260

5361
if self.is_valid then
54-
self.label = self:_generate_label()
55-
local highlight = self:_generate_highlight()
56-
if highlight then
57-
table.insert(self.highlights, highlight)
58-
end
59-
self:_add_keyword_highlight()
62+
self:_generate_data()
63+
end
64+
end
65+
66+
function AgendaItem:_generate_data()
67+
self.label = self:_generate_label()
68+
self.highlights = {}
69+
local highlight = self:_generate_highlight()
70+
if highlight then
71+
table.insert(self.highlights, highlight)
6072
end
73+
self:_add_keyword_highlight()
6174
end
6275

6376
function AgendaItem:_is_valid_for_today()

0 commit comments

Comments
 (0)