diff options
author | Magnus Henoch <magnus.henoch@gmail.com> | 2010-08-27 16:40:31 +0000 |
---|---|---|
committer | Carsten Dominik <carsten.dominik@gmail.com> | 2010-08-27 16:27:38 +0200 |
commit | b2861749d09ff9c09a7dca2b009a3513ec72b594 (patch) | |
tree | 84f94b0171034eb2b2e07237553a026277bed9b6 | |
parent | 7be6f7e3d58c57b6b9b1dce0225f63e46de38ec2 (diff) | |
download | org-mode-b2861749d09ff9c09a7dca2b009a3513ec72b594.tar.gz |
Fix :step day for agenda clockreport
I just tried adding :step day to
org-agenda-clockreport-parameter-plist, but then hitting R in the
agenda caused a crash, since org-clocktable-steps expects ts and te to
be strings, though in fact they are Gregorian day numbers.
This patch fixes the problem for me. It's quite ugly, so I don't
expect it to be committed in its current form :) but I hope it serves
as inspiration for someone to figure out the right way to solve this.
* lisp/org-clock.el (org-clocktable-steps): Allow ts and te to be
day numbers.
TINYCHANGE
-rw-r--r-- | lisp/org-clock.el | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/lisp/org-clock.el b/lisp/org-clock.el index 4fa0397..5e4f4ef 100644 --- a/lisp/org-clock.el +++ b/lisp/org-clock.el @@ -1971,10 +1971,22 @@ the currently selected interval size." (when block (setq cc (org-clock-special-range block nil t) ts (car cc) te (nth 1 cc) range-text (nth 2 cc))) - (if ts (setq ts (org-float-time - (apply 'encode-time (org-parse-time-string ts))))) - (if te (setq te (org-float-time - (apply 'encode-time (org-parse-time-string te))))) + (cond + ((numberp ts) + ;; If ts is a number, it's an absolute day number from org-agenda. + (destructuring-bind (month day year) (calendar-gregorian-from-absolute ts) + (setq ts (org-float-time (encode-time 0 0 0 day month year))))) + (ts + (setq ts (org-float-time + (apply 'encode-time (org-parse-time-string ts)))))) + (cond + ((numberp te) + ;; Likewise for te. + (destructuring-bind (month day year) (calendar-gregorian-from-absolute te) + (setq te (org-float-time (encode-time 0 0 0 day month year))))) + (te + (setq te (org-float-time + (apply 'encode-time (org-parse-time-string te)))))) (setq p1 (plist-put p1 :header "")) (setq p1 (plist-put p1 :step nil)) (setq p1 (plist-put p1 :block nil)) |