Просмотр исходного кода

Make the agenda clockreport configurable.

We now have an option that allows to specify properties for the
report table.  Most interesting is probably to set :maxlevel.
Carsten Dominik 17 лет назад
Родитель
Сommit
b9293a6766
4 измененных файлов с 32 добавлено и 12 удалено
  1. 1 0
      ChangeLog
  2. 3 1
      ORGWEBPAGE/Changes.org
  3. 28 9
      lisp/org-agenda.el
  4. 0 2
      lisp/org-clock.el

+ 1 - 0
ChangeLog

@@ -2,6 +2,7 @@
 
 
 	* lisp/org-agenda.el (org-agenda-start-with-clockreport-mode): New
 	* lisp/org-agenda.el (org-agenda-start-with-clockreport-mode): New
 	option.
 	option.
+	(org-agenda-clockreport-parameter-plist): New option.
 
 
 	* lisp/org-clock.el (org-dblock-write:clocktable): Request the
 	* lisp/org-clock.el (org-dblock-write:clocktable): Request the
 	unrestricted list of files.
 	unrestricted list of files.

+ 3 - 1
ORGWEBPAGE/Changes.org

@@ -59,7 +59,9 @@
     agenda, a clock table will be attached to the agenda, showing
     agenda, a clock table will be attached to the agenda, showing
     the clock report for the file scope and time interval of the
     the clock report for the file scope and time interval of the
     agenda view.  To turn this on permanently, configure the
     agenda view.  To turn this on permanently, configure the
-    variable =org-agenda-start-with-clockreport-mode=.
+    variable =org-agenda-start-with-clockreport-mode=.  To modify
+    the properties of the table, in particula the =:maxlevel=
+    depth, configure =org-agenda-clockreport-parameter-plist=.
 
 
 *** Selective tag inheritance
 *** Selective tag inheritance
 
 

+ 28 - 9
lisp/org-agenda.el

@@ -486,11 +486,6 @@ Needs to be set before org.el is loaded."
   :group 'org-agenda-startup
   :group 'org-agenda-startup
   :type 'boolean)
   :type 'boolean)
 
 
-(defcustom org-agenda-start-with-clockreport-mode nil
-  "The initial value of clockreport-mode in a newly created agenda window."
-  :group 'org-agenda-startup
-  :type 'boolean)
-
 (defgroup org-agenda-windows nil
 (defgroup org-agenda-windows nil
   "Options concerning the windows used by the Agenda in Org Mode."
   "Options concerning the windows used by the Agenda in Org Mode."
   :tag "Org Agenda Windows"
   :tag "Org Agenda Windows"
@@ -616,6 +611,24 @@ given here."
   :group 'org-agenda-daily/weekly
   :group 'org-agenda-daily/weekly
   :type 'number)
   :type 'number)
 
 
+(defcustom org-agenda-start-with-clockreport-mode nil
+  "The initial value of clockreport-mode in a newly created agenda window."
+  :group 'org-agenda-startup
+  :group 'org-agenda-daily/weekly
+  :type 'boolean)
+
+(defcustom org-agenda-clockreport-parameter-plist '(:link t :maxlevel 2)
+  "Property list with parameters for the clocktable in clockreport mode.
+This is the display mode that shows a clock table in the daily/weekly
+agenda, the properties for this dynamic block can be set here.
+The usual clocktable parameters are allowed here, but you cannot set
+the properties :name, :tstart, :tend, :block, and :scope - these will
+be overwritten to make sure the content accurately reflects the
+current display in the agenda."
+  :group 'org-agenda-daily/weekly
+  :type 'plist)
+
+
 (defgroup org-agenda-time-grid nil
 (defgroup org-agenda-time-grid nil
   "Options concerning the time grid in the Org-mode Agenda."
   "Options concerning the time grid in the Org-mode Agenda."
   :tag "Org Agenda Time Grid"
   :tag "Org Agenda Time Grid"
@@ -2268,10 +2281,16 @@ given in `org-agenda-start-on-weekday'."
 	    (put-text-property s (1- (point)) 'day d)
 	    (put-text-property s (1- (point)) 'day d)
 	    (put-text-property s (1- (point)) 'org-day-cnt day-cnt))))
 	    (put-text-property s (1- (point)) 'org-day-cnt day-cnt))))
     (when (and org-agenda-clockreport-mode clocktable-start)
     (when (and org-agenda-clockreport-mode clocktable-start)
-      (let ((org-agenda-files (org-agenda-files)))
-	;; the above line is to ensure the restricted range!
-	(insert (org-get-clocktable :tstart clocktable-start
-				    :tend clocktable-end :link t))))
+      (let ((org-agenda-files (org-agenda-files))
+	    ;; the above line is to ensure the restricted range!
+	    (p org-agenda-clockreport-parameter-plist)
+	    tbl)
+	(setq p (org-plist-delete p :block))
+	(setq p (plist-put p :tstart clocktable-start))
+	(setq p (plist-put p :tend clocktable-end))
+	(setq p (plist-put p :scope 'agenda))
+	(setq tbl (apply 'org-get-clocktable p))
+	(insert tbl)))
     (goto-char (point-min))
     (goto-char (point-min))
     (org-fit-agenda-window)
     (org-fit-agenda-window)
     (unless (and (pos-visible-in-window-p (point-min))
     (unless (and (pos-visible-in-window-p (point-min))

+ 0 - 2
lisp/org-clock.el

@@ -404,8 +404,6 @@ fontified, and then returned."
   (setq props (plist-put props :name "clocktable"))
   (setq props (plist-put props :name "clocktable"))
   (unless (plist-member props :maxlevel)
   (unless (plist-member props :maxlevel)
     (setq props (plist-put props :maxlevel 2)))
     (setq props (plist-put props :maxlevel 2)))
-  (unless (plist-member props :link)
-    (setq props (plist-put props :link nil)))    
   (unless (plist-member props :scope)
   (unless (plist-member props :scope)
     (setq props (plist-put props :scope 'agenda)))
     (setq props (plist-put props :scope 'agenda)))
   (with-temp-buffer
   (with-temp-buffer