emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Stephen Eglen <S.J.Eglen@damtp.cam.ac.uk>
To: emacs-orgmode@gnu.org
Cc: Stephen Eglen <S.J.Eglen@damtp.cam.ac.uk>
Subject: formatting times as HH:MM with leading zeros
Date: Wed, 20 Jan 2010 09:51:03 +0000	[thread overview]
Message-ID: <21605.1263981063@cpc1-cmbg14-2-0-cust6.5-4.cable.virginmedia.com> (raw)

Just a small suggestion here.  In the agenda, an entry like:
* <2010-01-20 Wed 09:00-09:30> test

gets formatted as follows:

Wednesday  20 January 2010
               8:00...... ----------------
  test:        9:00- 9:30 test
              10:00...... ----------------

the leading whitespace before '9:00' and '9:30' is needed to align the
times, but having the space after the dash looks odd (at least to my
latex-trained eyes).  Would it be possible to patch org-agenda to put a
leading zero rather than leading whitespace.  With this patch, I see:

Wednesday  20 January 2010
              08:00...... ----------------
  test:       09:00-09:30 test
              10:00...... ----------------


diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index a20bec5..77062ed 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -4902,6 +4902,7 @@ HH:MM."
 		    (mod h1 24) h1))
 	    (t0 (+ (* 100 h2) m))
 	    (t1 (concat (if (>= h1 24) "+" " ")
+			(if (< t0 1000) "0" "") ;zero-pad times before 10:00
 			(if (< t0 100) "0" "")
 			(if (< t0 10)  "0" "")
 			(int-to-string t0))))

             reply	other threads:[~2010-01-20  9:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-20  9:51 Stephen Eglen [this message]
2010-01-20 12:59 ` formatting times as HH:MM with leading zeros Matt Lundin
2010-01-20 17:29   ` Stephen Eglen
2010-01-20 19:02     ` Carsten Dominik
2010-01-20 20:28       ` Stephen Eglen
2010-01-21 15:02         ` Carsten Dominik
2010-01-21 15:17         ` Carsten Dominik

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=21605.1263981063@cpc1-cmbg14-2-0-cust6.5-4.cable.virginmedia.com \
    --to=s.j.eglen@damtp.cam.ac.uk \
    --cc=emacs-orgmode@gnu.org \
    /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).