org-timer: Fix timer setting from effort property

Testcase included.
This commit is contained in:
Marco Wahl 2017-07-05 12:33:47 +02:00
parent acabacaa56
commit 2b5ce91b35
2 changed files with 17 additions and 1 deletions

View file

@ -436,7 +436,7 @@ using three `C-u' prefix arguments."
(if (numberp org-timer-default-timer)
(number-to-string org-timer-default-timer)
org-timer-default-timer))
(effort-minutes (ignore-errors (org-get-at-eol 'effort-minutes 1)))
(effort-minutes (ignore-errors (floor (org-get-at-eol 'effort-minutes 1))))
(minutes (or (and (numberp opt) (number-to-string opt))
(and (not (equal opt '(64)))
effort-minutes

View file

@ -279,5 +279,21 @@ Also, mute output from `message'."
(org-timer-start))
:type (list 'error 'user-error)))
(ert-deftest test-org-timer/set-timer-from-effort-prop ()
"Test timer setting from effort property."
(should
(< (* 60 9) ; 9m
(test-org-timer/with-temp-text
"* foo
:PROPERTIES:
:Effort: 10
:END:"
(org-mode)
(org-timer-set-timer)
(org-timer-hms-to-secs (org-timer nil t)))
(1+ (* 60 10)) ; 10m 1s
)))
(provide 'test-org-timer)
;;; test-org-timer.el end here