emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] [PATCH] org-timer.el: Use hh:mm:ss format instead of minutes


From: Nicolas Goaziou
Subject: Re: [O] [PATCH] org-timer.el: Use hh:mm:ss format instead of minutes
Date: Fri, 01 May 2015 10:47:07 +0200

Hello,

Brice Waegenire <address@hidden> writes:

> I have took in consideration all of your points, is it better now?
> The current patch doesn't overwrite the present behavior of
> org-set-timer it only add the possibility to use hh:mm:ss format.

Thank you. 

Some comments follow in addition to Kyle's.

> From: Brice Waegeneire <address@hidden>
> Date: Fri, 24 Apr 2015 14:18:45 +0200
> Subject: [PATCH] org-timer.el: hh:mm:ss format for setting a timer
>
> * lisp/org-timer.el (org-timer-set-timer): Add support for hh:mm:ss format.
>
> * testing/lisp/test-org-timer.el (test-org-timer/set-timer): Add
> hh:mm:ss format in the test.

Commit message is incomplete, i.e., you changed default value for
`org-timer-default-timer'.

> ---
>  lisp/org-timer.el              | 23 ++++++++++++-----------
>  testing/lisp/test-org-timer.el |  8 ++++++++
>  2 files changed, 20 insertions(+), 11 deletions(-)
>
> diff --git a/lisp/org-timer.el b/lisp/org-timer.el
> index 0593573..022125f 100644
> --- a/lisp/org-timer.el
> +++ b/lisp/org-timer.el
> @@ -65,12 +65,12 @@ the value of the timer."
>    :group 'org-time
>    :type 'string)
>  
> -(defcustom org-timer-default-timer 0
> -  "The default timer when a timer is set.
> +(defcustom org-timer-default-timer "0"
> +  "The default timer when a timer is set, in minutes or hh:mm:ss format.
>  When 0, the user is prompted for a value."
>    :group 'org-time
>    :version "24.1"
> -  :type 'number)
> +  :type 'string)

Since you change default value, you need to update keywords:

  :version "25.1"
  :package-version '(Org . "8.3")

> +                  (and (listp opt) (not (null opt)) org-timer-default-timer)

  (and (consp opt) org-timer-default-timer)

>                    (read-from-minibuffer
> -                   "How many minutes left? "
> +                   "How much time left? (minutes or h:mm:ss) "
>                     (if (not (eq org-timer-default-timer 0))
> -                       (number-to-string org-timer-default-timer))))))
> +                       (eval org-timer-default-timer))))))
> +    (if (string-match "^[0-9]+$" minutes)
> +     (setq minutes (concat minutes ":00")))

  Nitpick: "\\`[0-9]+\\'"

>      (if (not (string-match "[0-9]+" minutes))
>       (org-timer-show-remaining-time)
> -      (let* ((mins (string-to-number (match-string 0 minutes)))
> -          (secs (* mins 60))
> +      (let* ((secs (org-timer-hms-to-secs (org-timer-fix-incomplete 
> minutes)))

  let* -> let


Regards,

-- 
Nicolas Goaziou



reply via email to

[Prev in Thread] Current Thread [Next in Thread]