From mboxrd@z Thu Jan 1 00:00:00 1970 From: Brice Waegenire Subject: Re: [PATCH] org-timer.el: Use hh:mm:ss format instead of minutes Date: Tue, 5 May 2015 16:34:29 +0200 Message-ID: References: <874mo58oa5.fsf@kmlap.domain.org> <87pp6kk7lg.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary=001a11440e34823667051556935b Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:42930) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ypdve-0003F9-Ul for emacs-orgmode@gnu.org; Tue, 05 May 2015 10:34:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ypdva-0004mh-Bh for emacs-orgmode@gnu.org; Tue, 05 May 2015 10:34:34 -0400 Received: from mail-qc0-x233.google.com ([2607:f8b0:400d:c01::233]:36493) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ypdva-0004mU-4n for emacs-orgmode@gnu.org; Tue, 05 May 2015 10:34:30 -0400 Received: by qcbgy10 with SMTP id gy10so35913878qcb.3 for ; Tue, 05 May 2015 07:34:29 -0700 (PDT) In-Reply-To: <87pp6kk7lg.fsf@nicolasgoaziou.fr> 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 , emacs-orgmode@gnu.org --001a11440e34823667051556935b Content-Type: text/plain; charset=UTF-8 Thanks for help on this! Here is the last version of the patch taking into account all of your comments. 2015-05-01 10:47 GMT+02:00 Nicolas Goaziou : > 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 --001a11440e34823667051556935b Content-Type: text/x-patch; charset=US-ASCII; name="0001-org-timer.el-hh-mm-ss-format-for-setting-a-timer.patch" Content-Disposition: attachment; filename="0001-org-timer.el-hh-mm-ss-format-for-setting-a-timer.patch" Content-Transfer-Encoding: base64 X-Attachment-Id: f_i9beumbb0 RnJvbSAwN2Q4NzFmMmI4MmFiMjNlMTg0MzA1ZGQzZTA4OGVhZjE4ZTZhNGYzIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBCcmljZSBXYWVnZW5laXJlIDxicmljZS53Z2VAZ21haWwuY29t PgpEYXRlOiBGcmksIDI0IEFwciAyMDE1IDE0OjE4OjQ1ICswMjAwClN1YmplY3Q6IFtQQVRDSF0g b3JnLXRpbWVyLmVsOiBoaDptbTpzcyBmb3JtYXQgZm9yIHNldHRpbmcgYSB0aW1lcgoKKiBsaXNw L29yZy10aW1lci5lbCAob3JnLXRpbWVyLXNldC10aW1lcik6IEFkZCBzdXBwb3J0IGZvciBoaDpt bTpzcwpmb3JtYXQuCihvcmctdGltZXItZGVmYXVsdC10aW1lcik6IFR5cGUgY2hhbmdlZCBmcm9t IG51bWJlciB0byBzdHJpbmcuCiogdGVzdGluZy9saXNwL3Rlc3Qtb3JnLXRpbWVyLmVsICh0ZXN0 LW9yZy10aW1lci9zZXQtdGltZXIpOiBBZGQKaGg6bW06c3MgZm9ybWF0IGluIHRoZSB0ZXN0Lgot LS0KIGxpc3Avb3JnLXRpbWVyLmVsICAgICAgICAgICAgICB8IDI4ICsrKysrKysrKysrKysrKy0t LS0tLS0tLS0tLS0KIHRlc3RpbmcvbGlzcC90ZXN0LW9yZy10aW1lci5lbCB8ICA4ICsrKysrKysr CiAyIGZpbGVzIGNoYW5nZWQsIDIzIGluc2VydGlvbnMoKyksIDEzIGRlbGV0aW9ucygtKQoKZGlm ZiAtLWdpdCBhL2xpc3Avb3JnLXRpbWVyLmVsIGIvbGlzcC9vcmctdGltZXIuZWwKaW5kZXggMDU5 MzU3My4uZDkyZjdiOSAxMDA2NDQKLS0tIGEvbGlzcC9vcmctdGltZXIuZWwKKysrIGIvbGlzcC9v cm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Z0PyAiCi0JCSAgICAg IChpZiAobm90IChlcSBvcmctdGltZXItZGVmYXVsdC10aW1lciAwKSkKLQkJCSAgKG51bWJlci10 by1zdHJpbmcgb3JnLXRpbWVyLWRlZmF1bHQtdGltZXIpKSkpKSkKKwkJICAgICAgIkhvdyBtdWNo IHRpbWUgbGVmdD8gKG1pbnV0ZXMgb3IgaDptbTpzcykgIgorCQkgICAgICAod2hlbiAobm90IChz dHJpbmctZXF1YWwgb3JnLXRpbWVyLWRlZmF1bHQtdGltZXIgIjAiKSkKKwkJCSAgKGV2YWwgb3Jn LXRpbWVyLWRlZmF1bHQtdGltZXIpKSkpKSkKKyAgICAod2hlbiAoc3RyaW5nLW1hdGNoICJcXGBb MC05XStcXCciIG1pbnV0ZXMpCisJKHNldHEgbWludXRlcyAoY29uY2F0IG1pbnV0ZXMgIjowMCIp KSkKICAgICAoaWYgKG5vdCAoc3RyaW5nLW1hdGNoICJbMC05XSsiIG1pbnV0ZXMpKQogCShvcmct dGltZXItc2hvdy1yZW1haW5pbmctdGltZSkKLSAgICAgIChsZXQqICgobWlucyAoc3RyaW5nLXRv LW51bWJlciAobWF0Y2gtc3RyaW5nIDAgbWludXRlcykpKQotCSAgICAgKHNlY3MgKCogbWlucyA2 MCkpCisgICAgICAobGV0ICgoc2VjcyAob3JnLXRpbWVyLWhtcy10by1zZWNzIChvcmctdGltZXIt Zml4LWluY29tcGxldGUgbWludXRlcykpKQogCSAgICAgKGhsIChvcmctdGltZXItLWdldC10aW1l ci10aXRsZSkpKQogCShpZiAob3IgKG5vdCBvcmctdGltZXItY291bnRkb3duLXRpbWVyKQogCQko ZXF1YWwgb3B0ICcoMTYpKQpkaWZmIC0tZ2l0IGEvdGVzdGluZy9saXNwL3Rlc3Qtb3JnLXRpbWVy LmVsIGIvdGVzdGluZy9saXNwL3Rlc3Qtb3JnLXRpbWVyLmVsCmluZGV4IDcxNjRhNWQuLjhhYmJi ODUgMTAwNjQ0Ci0tLSBhL3Rlc3RpbmcvbGlzcC90ZXN0LW9yZy10aW1lci5lbAorKysgYi90ZXN0 aW5nL2xpc3AvdGVzdC1vcmctdGltZXIuZWwKQEAgLTE3OCw2ICsxNzgsMTQgQEAgQWxzbywgbXV0 ZSBvdXRwdXQgZnJvbSBgbWVzc2FnZScuIgogCSAgICAgIChvcmctdGltZXItc2V0LXRpbWVyIDEw KSkKIAkgICAgKHRlc3Qtb3JnLXRpbWVyL3dpdGgtY3VycmVudC10aW1lIHRlc3Qtb3JnLXRpbWVy L3RpbWUxCiAJICAgICAgKG9yZy10aW1lcikpCisJICAgIChvcmctdHJpbSAoYnVmZmVyLXN0cmlu ZykpKSkpCisgIChzaG91bGQKKyAgIChlcXVhbCAiMDowMDowNCIKKwkgICh0ZXN0LW9yZy10aW1l ci93aXRoLXRlbXAtdGV4dCAiIgorCSAgICAodGVzdC1vcmctdGltZXIvd2l0aC1jdXJyZW50LXRp bWUgdGVzdC1vcmctdGltZXIvdGltZTAKKwkgICAgICAob3JnLXRpbWVyLXNldC10aW1lciAiMzoz MCIpKQorCSAgICAodGVzdC1vcmctdGltZXIvd2l0aC1jdXJyZW50LXRpbWUgdGVzdC1vcmctdGlt ZXIvdGltZTEKKwkgICAgICAob3JnLXRpbWVyKSkKIAkgICAgKG9yZy10cmltIChidWZmZXItc3Ry aW5nKSkpKSkpCiAKIChlcnQtZGVmdGVzdCB0ZXN0LW9yZy10aW1lci9wYXVzZS10aW1lciAoKQot LSAKMi4zLjcKCg== --001a11440e34823667051556935b--