org-agenda: fix start/end time in timerange

* org-agenda.el (org-agenda-get-blocks): Fix time of start/end
of events with range. This display things like:
<2011-01-22 Sat 14:00>--<2011-01-23 Sun 20:00>
correctly, with the event starting at 14:00 and ending at 20:00.

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2011-01-22 22:08:51 +00:00 committed by Carsten Dominik
parent 8d00354704
commit c78bf704ed
1 changed files with 49 additions and 43 deletions

View File

@ -5075,15 +5075,16 @@ FRACTION is what fraction of the head-warning time has passed."
(abbreviate-file-name buffer-file-name))))
(regexp org-tr-regexp)
(d0 (calendar-absolute-from-gregorian date))
marker hdmarker ee txt d1 d2 s1 s2 timestr category todo-state tags pos
marker hdmarker ee txt d1 d2 s1 s2 category todo-state tags pos
head donep)
(goto-char (point-min))
(while (re-search-forward regexp nil t)
(catch :skip
(org-agenda-skip)
(setq pos (point))
(setq timestr (match-string 0)
s1 (match-string 1)
(let ((start-time (match-string 1))
(end-time (match-string 2)))
(setq s1 (match-string 1)
s2 (match-string 2)
d1 (time-to-days (org-time-string-to-time s1))
d2 (time-to-days (org-time-string-to-time s2)))
@ -5117,13 +5118,18 @@ FRACTION is what fraction of the head-warning time has passed."
org-agenda-timerange-leaders)
(1+ (- d0 d1)) (1+ (- d2 d1)))
head category tags
timestr nil remove-re))))
(cond ((= d1 d0)
(concat "<" start-time ">"))
((= d2 d0)
(concat "<" end-time ">"))
(t nil))
remove-re))))
(org-add-props txt props
'org-marker marker 'org-hd-marker hdmarker
'type "block" 'date date
'todo-state todo-state
'priority (org-get-priority txt) 'org-category category)
(push txt ee)))
(push txt ee))))
(goto-char pos)))
;; Sort the entries by expiration date.
(nreverse ee)))