瀏覽代碼

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.
Bastien Guerry 15 年之前
父節點
當前提交
593022a66e
共有 4 個文件被更改,包括 24 次插入5 次删除
  1. 5 0
      doc/ChangeLog
  2. 2 0
      doc/org.texi
  3. 3 0
      lisp/ChangeLog
  4. 14 5
      lisp/org-clock.el

+ 5 - 0
doc/ChangeLog

@@ -1,3 +1,8 @@
+2009-07-26  Bastien Guerry  <bzg@altern.org>
+
+	* org.texi (Clocking work time): Add documentation for the
+	new :timetamp option when creating a clock report.
+
 2009-07-26  Dan Griswold <dgriswol@rochester.rr.com>  (tiny change)
 
 	* org.texi (Paragraphs): Fix many typos.

+ 2 - 0
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

+ 3 - 0
lisp/ChangeLog

@@ -1,5 +1,8 @@
 2009-07-25  Bastien Guerry  <bzg@altern.org>
 
+	* 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.

+ 14 - 5
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")