From 593022a66e856de42dcad60037674a900f2fe9cd Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Sun, 26 Jul 2009 06:05:09 +0800 Subject: [PATCH] Add a new :timestamp option for clock reports. Using :timetamp t as an option in a clock report now allows insertion of the timestamp for the clocked entry. Timestamps are searched for in this order: SCHEDULING, TIMESTAMP, DEADLINE and TIMESTAMP_IA. --- doc/ChangeLog | 5 +++++ doc/org.texi | 2 ++ lisp/ChangeLog | 3 +++ lisp/org-clock.el | 19 ++++++++++++++----- 4 files changed, 24 insertions(+), 5 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index 264ae4cd5..00bd23e00 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,8 @@ +2009-07-26 Bastien Guerry + + * org.texi (Clocking work time): Add documentation for the + new :timetamp option when creating a clock report. + 2009-07-26 Dan Griswold (tiny change) * org.texi (Paragraphs): Fix many typos. diff --git a/doc/org.texi b/doc/org.texi index 6a228fba1..e28b185c5 100644 --- a/doc/org.texi +++ b/doc/org.texi @@ -5439,6 +5439,8 @@ new table. The @samp{BEGIN} line can specify options: @r{As a special case, @samp{:formula %} adds a column with % time.} @r{If you do not specify a formula here, any existing formula.} @r{below the clock table will survive updates and be evaluated.} +:timestamp @r{A timestamp for the entry, when available. Look for SCHEDULED,} + @r{DEADLINE, TIMESTAMP and TIMESTAMP_IA, in this order.} @end example To get a clock summary of the current level 1 tree, for the current day, you could write diff --git a/lisp/ChangeLog b/lisp/ChangeLog index e2a698e5e..cb66edff3 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2009-07-25 Bastien Guerry + * org-clock.el (org-dblock-write:clocktable): Add a new option + :timestamp which allows display of timestamps in clock reports. + * org.el (org-mode-map): Define new key `C-c C-*': convert a plain list to a subtree, preserving the structure of the list. (org-set-emph-re): Make the last element optional in the regexp. diff --git a/lisp/org-clock.el b/lisp/org-clock.el index 8d70fd3ca..9275433cf 100644 --- a/lisp/org-clock.el +++ b/lisp/org-clock.el @@ -1192,11 +1192,12 @@ the currently selected interval size." (maxlevel (or (plist-get params :maxlevel) 3)) (step (plist-get params :step)) (emph (plist-get params :emphasize)) + (timestamp (plist-get params :timestamp)) (ts (plist-get params :tstart)) (te (plist-get params :tend)) (block (plist-get params :block)) (link (plist-get params :link)) - ipos time p level hlc hdl content recalc formula pcol + ipos time p level hlc hdl tsp props content recalc formula pcol cc beg end pos tbl tbl1 range-text rm-file-column scope-is-list st) (setq org-clock-file-total-minutes nil) (when step @@ -1301,10 +1302,18 @@ the currently selected interval size." (save-match-data (org-make-org-heading-search-string (match-string 2)))) - (match-string 2)))) + (match-string 2))) + tsp (when timestamp + (setq props (org-entry-properties (point))) + (or (cdr (assoc "SCHEDULED" props)) + (cdr (assoc "TIMESTAMP" props)) + (cdr (assoc "DEADLINE" props)) + (cdr (assoc "TIMESTAMP_IA" props))))) (if (and (not multifile) (= level 1)) (push "|-" tbl)) (push (concat - "| " (int-to-string level) "|" hlc hdl hlc " |" + "| " (int-to-string level) "|" + (if timestamp (concat tsp "|") "") + hlc hdl hlc " |" (make-string (1- level) ?|) hlc (org-minutes-to-hh:mm-string time) hlc " |") tbl)))))) @@ -1323,12 +1332,12 @@ the currently selected interval size." (if block (concat ", for " range-text ".") "") "\n\n")) (if scope-is-list "|File" "") - "|L|Headline|Time|\n") + "|L|" (if timestamp "Timestamp|" "") "Headline|Time|\n") (setq total-time (or total-time org-clock-file-total-minutes)) (insert-before-markers "|-\n|" (if scope-is-list "|" "") - "|" + (if timestamp "|Timestamp|" "|") "*Total time*| *" (org-minutes-to-hh:mm-string (or total-time 0)) "*|\n|-\n")