[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Get a list of tasks completed today
From: |
Sebastien Vauban |
Subject: |
Re: [O] Get a list of tasks completed today |
Date: |
Mon, 17 Feb 2014 14:40:55 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (windows-nt) |
"Loris Bennett" wrote:
> "Sebastien Vauban" <address@hidden> writes:
>> "Sebastien Vauban" wrote:
>>> To get a list of tasks which I've completed today, I guess we must have:
>>>
>>> (setq org-log-done t) ; default
>>>
>>> I mean: I guess it's more dangerous to try and play with the "state
>>> changes" information stored in the LOGBOOK drawer as people can easily
>>> modify them (see `org-log-note-headings').
>>>
>>> Under the above assumption, the request becomes:
>>>
>>> (add-to-list 'org-agenda-custom-commands
>>> '("." "Completed today"
>>> ((todo "DONE|CANX"
>>> ((org-agenda-skip-function '(org-agenda-skip-entry-if
>>> 'notregexp "CLOSED: \\[2014-02-13"))
>>> (org-agenda-sorting-strategy '(priority-down)))))) t)
>>>
>>> ... for today.
>>>
>>> But how can I include today's date in a programmatic way (so that it
>>> continues to work tomorrow ;-))?
>>
>> That one is solved by doing this:
>>
>> #+begin_src emacs-lisp
>> (add-to-list 'org-agenda-custom-commands
>> '("." "Completed today"
>> ((todo ""
>> ((org-agenda-skip-function
>> '(org-agenda-skip-entry-if 'notregexp
>> (format-time-string "CLOSED: \\[%Y-%m-%d")))))
>> (org-agenda-sorting-strategy '(priority-down))))))
>> t)
>> #+end_src
Note that the above DOES NOT WORK if you don't specify TODO states such as:
--8<---------------cut here---------------start------------->8---
((todo "DONE|CANX"
--8<---------------cut here---------------end--------------->8---
I have the impression this is a bug.
Moreover, you should even add active states such as "TODO" for
repeatable actions which do go back to the "TODO" state; hence, it
becomes:
--8<---------------cut here---------------start------------->8---
((todo "TODO|DONE|CANX"
--8<---------------cut here---------------end--------------->8---
> I don't really understand the lisp, but I'm guessing that %Y, %m, and %d
> hold the current year, month, and day, respectively, so I can see how
> the regex could be modified to deal with "last year" and "last month".
>
> However, more useful to me would be "last week", so what approach should
> I take for that?
I guess you should begin playing with things such as:
--8<---------------cut here---------------start------------->8---
(time-add (current-time) (seconds-to-time -86400))
--8<---------------cut here---------------end--------------->8---
to point to yesterday, etc.
But I'm not sure this is the right approach...
Best regards,
Seb
--
Sebastien Vauban