Carsten Dominik <[email protected]> writes:
> I have applied this patch, thank you for your contribution!
My pleasure.
> No hurry, better to get it complete and tested...
> :-)
I should have read this advice more carefully :-)
Because before, when only sums where calculated as summaries, 0 was
placed instead of empty or non numeric properties.
This makes calcualtions wrong with min/mean/max operators.
I only use complete tables so I did not notice this before now.
So I have changed this behavior to ignore empty properties and also
hanlde cases when all properties are wrong.
diff --git a/lisp/org-colview-xemacs.el b/lisp/org-colview-xemacs.el
index 5986d43..c63d906 100644
--- a/lisp/org-colview-xemacs.el
+++ b/lisp/org-colview-xemacs.el
@@ -1097,7 +1097,8 @@ Don't set this, this is meant for dynamic scoping.")
(cond
((< level last-level)
;; put the sum of lower levels here as a property
- (setq sum (apply fun (aref lvals last-level))
+ (setq sum (when (aref lvals last-level)
+ (apply fun (aref lvals last-level)))
flag (aref lflag last-level) ; any valid entries from children?
str (org-columns-number-to-string sum format printf)
str1 (org-add-props (copy-sequence str) nil 'org-computed t 'face 'bold)
@@ -1123,9 +1124,10 @@ Don't set this, this is meant for dynamic scoping.")
(aset lflag l nil)))
((>= level last-level)
;; add what we have here to the accumulator for this level
- (push (org-column-string-to-number (or val "0") format)
+ (when valflag
+ (push (org-column-string-to-number val format)
(aref lvals level))
- (and valflag (aset lflag level t)))
+ (aset lflag level t)))
(t (error "This should not happen")))))))
(defun org-columns-redo ()
@@ -1163,6 +1165,7 @@ Don't set this, this is meant for dynamic scoping.")
(defun org-columns-number-to-string (n fmt &optional printf)
"Convert a computed column number to a string value, according to FMT."
(cond
+ ((not (numberp n)) "")
((memq fmt '(add_times max_times min_times mean_times))
(let* ((h (floor n)) (m (floor (+ 0.5 (* 60 (- n h))))))
(format org-time-clocksum-format h m)))
diff --git a/lisp/org-colview.el b/lisp/org-colview.el
index 5e2810f..cd9ea2b 100644
--- a/lisp/org-colview.el
+++ b/lisp/org-colview.el
@@ -910,7 +910,8 @@ Don't set this, this is meant for dynamic scoping.")
(cond
((< level last-level)
;; put the sum of lower levels here as a property
- (setq sum (apply fun (aref lvals last-level))
+ (setq sum (when (aref lvals last-level)
+ (apply fun (aref lvals last-level)))
flag (aref lflag last-level) ; any valid entries from children?
str (org-columns-number-to-string sum format printf)
str1 (org-add-props (copy-sequence str) nil 'org-computed t 'face 'bold)
@@ -936,9 +937,10 @@ Don't set this, this is meant for dynamic scoping.")
(aset lflag l nil)))
((>= level last-level)
;; add what we have here to the accumulator for this level
- (push (org-column-string-to-number (or val "0") format)
+ (when valflag
+ (push (org-column-string-to-number val format)
(aref lvals level))
- (and valflag (aset lflag level t)))
+ (aset lflag level t)))
(t (error "This should not happen")))))))
(defun org-columns-redo ()
@@ -976,6 +978,7 @@ Don't set this, this is meant for dynamic scoping.")
(defun org-columns-number-to-string (n fmt &optional printf)
"Convert a computed column number to a string value, according to FMT."
(cond
+ ((not (numberp n)) "")
((memq fmt '(add_times max_times min_times mean_times))
(let* ((h (floor n)) (m (floor (+ 0.5 (* 60 (- n h))))))
(format org-time-clocksum-format h m)))
--
Mikael Fornius
_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
[email protected]
http://lists.gnu.org/mailman/listinfo/emacs-orgmode