Skip to content

Commit 0112e06

Browse files
committed
Print nice weekly agenda.
1 parent ecb3166 commit 0112e06

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@
22
*.swp
33
tags
44
.ropeproject
5+
.cover*
6+
cover*

ftplugin/orgmode/plugins/Agenda.py

+22-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# -*- coding: utf-8 -*-
2-
from orgmode import ORGMODE, settings, echom
2+
3+
from datetime import date
4+
5+
from orgmode import ORGMODE, settings
36
from orgmode.keybinding import Keybinding, Plug
47
from orgmode.menu import Submenu, ActionEntry
58
import vim
@@ -48,13 +51,29 @@ def list_next_week(cls):
4851
cmd = [u'setlocal filetype=orgtodo']
4952
cls._switch_to('AGENDA', cmd)
5053

51-
final_agenda = []
54+
last_date = agenda[0].active_date
55+
final_agenda = [str(last_date)]
5256
# format text for agenda
5357
for i, h in enumerate(agenda):
54-
tmp = "%s %s" % (str(h.todo), str(h.title))
58+
# insert date information for every new date
59+
if h.active_date != last_date:
60+
today = date.today()
61+
if h.active_date.year == today.year and \
62+
h.active_date.month == today.month and \
63+
h.active_date.day == today.day:
64+
section = str(h.active_date) + " TODAY"
65+
else:
66+
section = str(h.active_date)
67+
final_agenda.append(section)
68+
69+
# update last_date
70+
last_date = h.active_date
71+
72+
tmp = " %s %s" % (str(h.todo), str(h.title))
5573
final_agenda.append(tmp)
5674

5775
# show agenda
76+
print final_agenda
5877
vim.current.buffer[:] = final_agenda
5978
vim.command(u'setlocal nomodifiable')
6079

0 commit comments

Comments
 (0)