summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2016-02-21 14:22:23 +0100
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2016-02-21 14:22:23 +0100
commitcd5eb50fd1c2a68734da173ae65ffc85b26cd9b0 (patch)
tree8690c8ec1c73c758519168f329e0e6eed4735220
parentfedd6be97ae03c9cdd0bf67c2691100cec86ad70 (diff)
downloadorg-mode-cd5eb50fd1c2a68734da173ae65ffc85b26cd9b0.tar.gz
org-colview: Fix CLOCKSUM and CLOCKSUM_T summaries
* lisp/org-colview.el (org-columns--summarize): New function. (org-columns-new): (org-columns-compile-format): Use new function. (org-agenda-colview-summarize): Use new function. Fix return value for CLOCKSUM and CLOCKSUM_T.
-rw-r--r--lisp/org-colview.el27
1 files changed, 12 insertions, 15 deletions
diff --git a/lisp/org-colview.el b/lisp/org-colview.el
index 999d8ed..6618ab9 100644
--- a/lisp/org-colview.el
+++ b/lisp/org-colview.el
@@ -291,6 +291,11 @@ WIDTH as an integer greater than 0."
(push ov org-columns-overlays)
ov))
+(defun org-columns--summarize (operator)
+ "Return summary function associated to string OPERATOR."
+ (cdr (or (assoc operator org-columns-summary-types)
+ (assoc operator org-columns-summary-types-default))))
+
(defun org-columns--overlay-text (value fmt width property original)
"Return text "
(format fmt
@@ -828,10 +833,7 @@ When COLUMNS-FMT-STRING is non-nil, use it as the column format."
(append org-columns-summary-types
org-columns-summary-types-default)))
nil t))))
- (summarize
- (or summarize
- (cdr (or (assoc operator org-columns-summary-types)
- (assoc operator org-columns-summary-types-default)))))
+ (summarize (or summarize (org-columns--summarize operator)))
(edit
(and prop (assoc-string prop org-columns-current-fmt-compiled t))))
(if edit
@@ -1027,16 +1029,10 @@ This function updates `org-columns-current-fmt-compiled'."
(when (string-match ";" operator)
(setq printf (substring operator (match-end 0)))
(setq operator (substring operator 0 (match-beginning 0))))
- (let* ((summary-type
- (or (assoc operator org-columns-summary-types)
- (assoc operator org-columns-summary-types-default)))
- (summarize
- (cond
- ((not summary-type)
- (user-error "Unknown summary operator: %S" operator))
- ((cdr summary-type))
- (t (user-error "Missing summary function for type: %S"
- operator)))))
+ (let* ((summarize
+ (or (org-columns--summarize operator)
+ (user-error "Cannot find %S summary function"
+ operator))))
(list prop title width operator printf summarize))))
org-columns-current-fmt-compiled)))
(setq org-columns-current-fmt-compiled
@@ -1536,7 +1532,8 @@ This will add overlays to the date lines, to show the summary for each day."
(pcase spec
(`(,property ,title ,width . ,_)
(if (member-ignore-case property '("CLOCKSUM" "CLOCKSUM_T"))
- (list property title width ":" 'add_times nil '+ nil)
+ (let ((summarize (org-columns--summarize ":")))
+ (list property title width ":" nil summarize))
spec))))
org-columns-current-fmt-compiled))
entries)