summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Dominik <carsten.dominik@gmail.com>2010-01-21 16:02:44 +0100
committerCarsten Dominik <carsten.dominik@gmail.com>2010-01-21 16:02:44 +0100
commitb034a4e1ed2ca410c06f0f482a70699ef8ad11a6 (patch)
tree383fc0fdf15c34938372128e6197856ce9c4b028
parent566dac98b31180514aa14c24c60a20ffd8e10fc2 (diff)
downloadorg-mode-b034a4e1ed2ca410c06f0f482a70699ef8ad11a6.tar.gz
New option to get times in agenda zero padded instead of blank padded
Patch by Stephen Eglen, who writes: > 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...... ---------------- This patch introduces a new user option to select this behavior.
-rwxr-xr-xlisp/ChangeLog6
-rw-r--r--lisp/org-agenda.el8
2 files changed, 14 insertions, 0 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 3a86187..d607a07 100755
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
+2010-01-20 Stephen Eglen <stephen@gnu.org>
+
+ * org-agenda.el (org-get-time-of-day): Use
+ org-agenda-time-leading-zero to allow leading zero (rather than
+ space) for times.
+
2010-01-20 Carsten Dominik <carsten.dominik@gmail.com>
* org-agenda.el (org-agenda-diary-entry-in-org-file): Make sure
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 9a76563..10e94ce 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -805,6 +805,12 @@ This function makes sure that dates are aligned for easy reading."
(format "%-10s %2d %s %4d%s"
dayname day monthname year weekstring)))
+(defcustom org-agenda-time-leading-zero nil
+ "Non-nil means use leading zero for military times in agenda.
+For example, 9:30am would become 09:30 rather than 9:30."
+ :group 'org-agenda-daily/weekly
+ :type 'boolean)
+
(defcustom org-agenda-weekend-days '(6 0)
"Which days are weekend?
These days get the special face `org-agenda-date-weekend' in the agenda
@@ -4902,6 +4908,8 @@ HH:MM."
(mod h1 24) h1))
(t0 (+ (* 100 h2) m))
(t1 (concat (if (>= h1 24) "+" " ")
+ (if (and org-agenda-time-leading-zero
+ (< t0 1000)) "0" "")
(if (< t0 100) "0" "")
(if (< t0 10) "0" "")
(int-to-string t0))))