From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: [PATCH] org-timer.el: Use hh:mm:ss format instead of minutes Date: Fri, 01 May 2015 10:47:07 +0200 Message-ID: <87pp6kk7lg.fsf@nicolasgoaziou.fr> References: <874mo58oa5.fsf@kmlap.domain.org> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:58052) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yo6Zv-0005t2-4P for emacs-orgmode@gnu.org; Fri, 01 May 2015 04:45:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yo6Zu-0004s7-60 for emacs-orgmode@gnu.org; Fri, 01 May 2015 04:45:47 -0400 Received: from relay3-d.mail.gandi.net ([2001:4b98:c:538::195]:50425) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yo6Zt-0004s3-T0 for emacs-orgmode@gnu.org; Fri, 01 May 2015 04:45:46 -0400 In-Reply-To: (Brice Waegenire's message of "Wed, 29 Apr 2015 23:52:58 +0200") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Brice Waegenire Cc: emacs-orgmode@gnu.org Hello, Brice Waegenire 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 > 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