|
1 | 1 | # -*- coding: utf-8 -*-
|
2 |
| -from orgmode import ORGMODE, settings, echom |
| 2 | + |
| 3 | +from datetime import date |
| 4 | + |
| 5 | +from orgmode import ORGMODE, settings |
3 | 6 | from orgmode.keybinding import Keybinding, Plug
|
4 | 7 | from orgmode.menu import Submenu, ActionEntry
|
5 | 8 | import vim
|
@@ -48,13 +51,29 @@ def list_next_week(cls):
|
48 | 51 | cmd = [u'setlocal filetype=orgtodo']
|
49 | 52 | cls._switch_to('AGENDA', cmd)
|
50 | 53 |
|
51 |
| - final_agenda = [] |
| 54 | + last_date = agenda[0].active_date |
| 55 | + final_agenda = [str(last_date)] |
52 | 56 | # format text for agenda
|
53 | 57 | 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)) |
55 | 73 | final_agenda.append(tmp)
|
56 | 74 |
|
57 | 75 | # show agenda
|
| 76 | + print final_agenda |
58 | 77 | vim.current.buffer[:] = final_agenda
|
59 | 78 | vim.command(u'setlocal nomodifiable')
|
60 | 79 |
|
|
0 commit comments