From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: [PATCH] Timestamps: Handle sub-10-min ranges when updating timestamps Date: Wed, 07 Aug 2013 15:56:28 +0200 Message-ID: <87wqnxa9kj.fsf@gmail.com> References: <1375321732-26199-1-git-send-email-trevor.m.murphy@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:36282) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V74Dy-0005hV-Vc for emacs-orgmode@gnu.org; Wed, 07 Aug 2013 09:56:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V74Dq-00057c-J9 for emacs-orgmode@gnu.org; Wed, 07 Aug 2013 09:56:26 -0400 Received: from mail-we0-x234.google.com ([2a00:1450:400c:c03::234]:38877) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V74Dq-00057O-De for emacs-orgmode@gnu.org; Wed, 07 Aug 2013 09:56:18 -0400 Received: by mail-we0-f180.google.com with SMTP id p61so1552540wes.25 for ; Wed, 07 Aug 2013 06:56:17 -0700 (PDT) In-Reply-To: <1375321732-26199-1-git-send-email-trevor.m.murphy@gmail.com> (Trevor Murphy's message of "Wed, 31 Jul 2013 21:48:52 -0400") 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: Trevor Murphy Cc: emacs-orgmode@gnu.org Hello, Trevor Murphy writes: > * lisp/org.el (org-get-compact-tod): Pad with "0" if # of minutes is > less than 10. Thanks for your patch. Would you mind providing a test-case for it? I'm not sure about the use of `org-get-compact-tod'. > --- > lisp/org.el | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/lisp/org.el b/lisp/org.el > index 26e653f..89e023c 100644 > --- a/lisp/org.el > +++ b/lisp/org.el > @@ -16088,9 +16088,12 @@ with the current time without prompting the user." > (if (not t2) > t1 > (setq dh (- h2 h1) dm (- m2 m1)) > - (if (< dm 0) (setq dm (+ dm 60) dh (1- dh))) > + (when (< dm 0) (setq dm (+ dm 60) dh (1- dh))) Although I agree with this change, this is not strictly necessary here. > (concat t1 "+" (number-to-string dh) > - (if (/= 0 dm) (concat ":" (number-to-string dm)))))))) > + (when (/= 0 dm) (concat ":" > + (if (< dm 10) > + (concat "0" (number-to-string dm)) > + (number-to-string dm))))))))) It would be better to use a 0-padded format string, e.g., (and (/= 0 dm) (format ":%02d" dm)) Regards, -- Nicolas Goaziou