diff options
author | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2015-10-25 18:21:03 +0100 |
---|---|---|
committer | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2015-10-25 18:21:03 +0100 |
commit | 3072cb28e8627066f465f1a4af85da88135d0549 (patch) | |
tree | 89454415bb0a8f945ea372221e70e41a634db0ed | |
parent | dae03e879071ef8ce4acdbd267cbbbe13264e205 (diff) | |
download | org-mode-3072cb28e8627066f465f1a4af85da88135d0549.tar.gz |
org-agenda: Improve display for repeaters
* lisp/org-agenda.el (org-agenda-get-deadlines):
(org-agenda-get-scheduled): For past repeaters, compute the number of
scheduled or deadline days since original date, not closest repeater.
Suggested-by: cesar mena <cmena@pobox.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/101884>
-rw-r--r-- | lisp/org-agenda.el | 51 |
1 files changed, 31 insertions, 20 deletions
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index e7a3776..69e39b2 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -6132,19 +6132,25 @@ specification like [h]h:mm." (setq timestr (concat (substring s (match-beginning 1)) " ")) (setq timestr 'time)) - (setq txt (org-agenda-format-item - (cond ((= diff 0) dl0) - ((> diff 0) - (if (functionp dl1) - (funcall dl1 diff date) - (format dl1 diff))) - (t - (if (functionp dl2) - (funcall dl2 diff date) - (format dl2 (if (string= dl2 dl1) - diff (abs diff)))))) - head level category tags - (if (not (= diff 0)) nil timestr))))) + (setq txt + (org-agenda-format-item + ;; For past deadlines, make sure to report + ;; time difference since date S, not since + ;; closest repeater. + (let ((diff (if (> d1 (org-today)) diff + (- (org-time-string-to-absolute s) d1)))) + (cond ((= diff 0) dl0) + ((> diff 0) + (if (functionp dl1) + (funcall dl1 diff date) + (format dl1 diff))) + (t + (if (functionp dl2) + (funcall dl2 diff date) + (format dl2 (if (string= dl2 dl1) + diff (abs diff))))))) + head level category tags + (if (not (= diff 0)) nil timestr))))) (when txt (setq face (org-agenda-deadline-face dfrac)) (org-add-props txt props @@ -6187,12 +6193,12 @@ an hour specification like [h]h:mm." org-scheduled-time-hour-regexp org-scheduled-time-regexp)) (todayp (org-agenda-todayp date)) ; DATE bound by calendar - (d1 (calendar-absolute-from-gregorian date)) ; DATE bound by calendar + (d1 (calendar-absolute-from-gregorian date)) ; DATE bound by calendar mm (deadline-position-alist (mapcar (lambda (a) (and (setq mm (get-text-property - 0 'org-hd-marker a)) - (cons (marker-position mm) a))) + 0 'org-hd-marker a)) + (cons (marker-position mm) a))) deadline-results)) d2 diff pos pos1 category level tags donep ee txt head pastschedp todo-state face timestr s habitp show-all @@ -6314,10 +6320,15 @@ an hour specification like [h]h:mm." (concat (substring s (match-beginning 1)) " ")) (setq timestr 'time)) (setq txt (org-agenda-format-item - (if (= diff 0) - (car org-agenda-scheduled-leaders) - (format (nth 1 org-agenda-scheduled-leaders) - (- 1 diff))) + ;; For past scheduled dates, make sure to + ;; report time difference since date S, not + ;; since closest repeater. + (let ((diff + (if (<= (org-today) d1) diff + (- (org-time-string-to-absolute s) d1)))) + (if (= diff 0) (car org-agenda-scheduled-leaders) + (format (nth 1 org-agenda-scheduled-leaders) + (- 1 diff)))) head level category tags (if (not (= diff 0)) nil timestr) nil habitp)))) |