瀏覽代碼

org-colview: Plain numbers are minutes instead of hours

* lisp/org-colview.el (org-columns--summary-apply-times): Use the same
  rule as everywhere else in Org.
* doc/org-manual.org (Column attributes): Document change.

Reported-by: Bernt Hansen <bernt@norang.ca>
<http://lists.gnu.org/r/emacs-orgmode/2018-05/msg00294.html>
Nicolas Goaziou 6 年之前
父節點
當前提交
fc5ee0f87b
共有 2 個文件被更改,包括 2 次插入11 次删除
  1. 1 1
      doc/org-manual.org
  2. 1 10
      lisp/org-colview.el

+ 1 - 1
doc/org-manual.org

@@ -5404,7 +5404,7 @@ optional.  The individual parts have the following meaning:
      | =X=      | Checkbox status, =[X]= if all children are =[X]=.     |
      | =X/=     | Checkbox status, =[n/m]=.                             |
      | =X%=     | Checkbox status, =[n%]=.                              |
-     | =:=      | Sum times, HH:MM, plain numbers are hours.            |
+     | =:=      | Sum times, HH:MM, plain numbers are minutes.          |
      | =:min=   | Smallest time value in column.                        |
      | =:max=   | Largest time value.                                   |
      | =:mean=  | Arithmetic mean of time values.                       |

+ 1 - 10
lisp/org-colview.el

@@ -1110,16 +1110,7 @@ as a canonical duration, i.e., using units defined in
   "Apply FUN to time values TIMES.
 Return the result as a duration."
   (org-duration-from-minutes
-   (apply fun
-	  (mapcar (lambda (time)
-		    ;; Unlike to `org-duration-to-minutes' standard
-		    ;; behavior, we want to consider plain numbers as
-		    ;; hours.  As a consequence, we treat them
-		    ;; differently.
-		    (if (string-match-p "\\`[0-9]+\\(?:\\.[0-9]*\\)?\\'" time)
-			(* 60 (string-to-number time))
-		      (org-duration-to-minutes time)))
-		  times))
+   (apply fun (mapcar #'org-duration-to-minutes times))
    (org-duration-h:mm-only-p times)))
 
 (defun org-columns--compute-spec (spec &optional update)