Adding calculations based on time to the Org Agenda clock report
Posted: - Modified: | emacs, orgDuplicating this answer on my blog in case StackOverflow goes away. =)
Leo asked:
I’m trying to make the Agenda Clockreport show how many pomodoros I’ve invested in a task. A Pomodoro is 25 minutes. For example, 1:15 hours of work is 3 pomodoros.
I’m trying to customize org-agenda-clockreport-paramater-plist, and I would like to extract “Time” and convert it to a pomodoro. I.e., (time in minutes / 25) = pomodoro.
I wrote:
This will create a column in your clocktable report that sums the hours from columns 3 and 4, and then another column that shows you the round number of pomodoros that took up.
(setq org-agenda-clockreport-parameter-plist '(:link t :maxlevel 2 :formula "$5=$3+$4;t::$6=ceil($5*60/25);N"))If you don’t want in-between columns, here’s a totally hackish approach:
(defun my/org-minutes-to-clocksum-string (m) "Format number of minutes as a clocksum string. Shows the number of 25-minute pomodoros." (format "%dp" (ceiling (/ m 25)))) (fset 'org-minutes-to-clocksum-string 'my/org-minutes-to-clocksum-string)Alternatively, you can use
:formatter
, but the formatting function looks very long and annoying to change.
Leo eventually configured it with:
(setq org-agenda-clockreport-parameter-plist '(:fileskip0 t :link t :maxlevel 2 :formula "$5=($3+$4)*(60/25);t"))
(He didn’t mind the decimals, I guess! =) )
4 comments
Leo Ufimtsev
2015-06-17T16:08:41ZX-D, ++
Päivi Eerola
2018-11-19T08:44:11ZHi, I am not sure where to ask about this. Sorry for taking your time. It's about timestamps. One thing I noticed is that when I use
* HEADING
SCHEDULED: <2018-11-18 Sun>
Leaving no space between heading and timestamp, the item appears in the agenda as a scheduled item. However, if I leave a space or have text in between heading and timestamp, like this:
* HEADING
Text Text Text
SCHEDULED: <2018-11-18 Sun>
Then it appears in the agenda as a one-time timestamp, and will behave like a one-time timestamp, not like an scheduled item (meaning, it will behave as if I had written <2018-11-18> and not SCHEDULED: <2018-11-18 Sun>.
Any insights about this?
Thanks in advance!
sachac
2018-11-19T13:47:52ZFor performance reasons, SCHEDULED needs to be right after the headline, yeah. Hope that's okay with you!
Päivi Eerola
2018-11-19T17:39:53ZWow, I did not know this. When I capture, I can paste a big chunk of text before adding the timestamp, and so I wish there was a way to invert the order of actions.