Merge branch 'maint'

This commit is contained in:
Nicolas Goaziou 2016-11-11 12:04:21 +01:00
commit b28377998d
2 changed files with 24 additions and 4 deletions

View File

@ -1068,12 +1068,12 @@ This function updates `org-columns-current-fmt-compiled'."
A time is expressed as HH:MM, HH:MM:SS, or with units defined in
`org-effort-durations'. Plain numbers are considered as hours."
(cond
((string-match "\\([0-9]+\\):\\([0-9]+\\)\\(?::\\([0-9]+\\)\\)?" s)
((string-match-p org-columns--duration-re s)
(* 60 (org-duration-string-to-minutes s)))
((string-match "\\`\\([0-9]+\\):\\([0-9]+\\)\\(?::\\([0-9]+\\)\\)?\\'" s)
(+ (* 3600 (string-to-number (match-string 1 s)))
(* 60 (string-to-number (match-string 2 s)))
(if (match-end 3) (string-to-number (match-string 3 s)) 0)))
((string-match-p org-columns--duration-re s)
(* 60 (org-duration-string-to-minutes s)))
(t (* 3600 (string-to-number s)))))
(defun org-columns--age-to-seconds (s)

View File

@ -471,7 +471,8 @@
(let ((org-columns-default-format "%A{@mean}")) (org-columns))
(get-char-property (point) 'org-columns-value-modified)))))
;; If a time value is expressed as a duration, return a duration.
;; If any of them follows H:MM:SS pattern, use it too.
;; If any of them follows H:MM:SS pattern, use it too. Also handle
;; combinations of duration and H:MM:SS patterns.
(should
(equal
"1d 4:20"
@ -506,6 +507,25 @@
:END:"
(let ((org-columns-default-format "%A{:}")) (org-columns))
(get-char-property (point) 'org-columns-value-modified))))
(should
(equal
"1d 4:20"
(org-test-with-temp-text
"* H
** S1
:PROPERTIES:
:A: 3d 3h
:END:
** S1
:PROPERTIES:
:A: 0d 1:20
:END:"
(let ((org-columns-default-format "%A{:}")
(org-time-clocksum-use-fractional nil)
(org-time-clocksum-format
'(:days "%dd " :hours "%d" :minutes ":%02d")))
(org-columns))
(get-char-property (point) 'org-columns-value-modified))))
;; @min, @max and @mean also accept regular duration in
;; a "?d ?h ?m ?s" format.
(should