From 253b60cdaf0c07bd166d3384f7a4f7152ab1e9a1 Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Sat, 24 May 2014 11:25:39 +0200 Subject: [PATCH] org.el (org-refresh-stats-properties): Fix arithmetic error * org.el (org-refresh-stats-properties): Fix arithmetic error. Thanks to Gregor Zattler for reporting this. --- lisp/org.el | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 0a71ab6ba..d50514263 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -9433,10 +9433,11 @@ call CMD." (concat org-outline-regexp-bol ".*" "\\(?:\\[\\([0-9]+\\)%\\|\\([0-9]+\\)/\\([0-9]+\\)\\]\\)") nil t) - (setq stats (if (match-string 2) - (/ (* (string-to-number (match-string 2)) 100) - (string-to-number (match-string 3))) - (string-to-number (match-string 1)))) + (setq stats (cond ((equal (match-string 3) "0") 0) + ((match-string 2) + (/ (* (string-to-number (match-string 2)) 100) + (string-to-number (match-string 3)))) + (t (string-to-number (match-string 1))))) (org-back-to-heading t) (put-text-property (point) (progn (org-end-of-subtree t t) (point)) 'org-stats stats)))))))