From: Nicolas Goaziou <n.goaziou@gmail.com>
To: Trevor Murphy <trevor.m.murphy@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: [PATCH] Timestamps: Handle sub-10-min ranges when updating timestamps
Date: Wed, 07 Aug 2013 15:56:28 +0200 [thread overview]
Message-ID: <87wqnxa9kj.fsf@gmail.com> (raw)
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")
Hello,
Trevor Murphy <trevor.m.murphy@gmail.com> 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
next prev parent reply other threads:[~2013-08-07 13:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-01 1:48 [PATCH] Timestamps: Handle sub-10-min ranges when updating timestamps Trevor Murphy
2013-08-07 13:56 ` Nicolas Goaziou [this message]
2013-08-08 6:31 ` Trevor Murphy
2013-08-08 8:22 ` Nicolas Goaziou
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87wqnxa9kj.fsf@gmail.com \
--to=n.goaziou@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=trevor.m.murphy@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).