Browse Source

org-agenda: Fix time of day presence

* lisp/org-agenda.el (org-agenda-get-deadlines): Small refactoring.
(org-agenda-get-scheduled): Do no insert a time of day when current
entry is only a reminder of a previously scheduled task.

Reported-by: Matt Lundin <mdl@imapmail.org>
<http://permalink.gmane.org/gmane.emacs.orgmode/110517>
Nicolas Goaziou 1 year ago
parent
commit
ba06303016
1 changed files with 18 additions and 10 deletions
  1. 18 10
      lisp/org-agenda.el

+ 18 - 10
lisp/org-agenda.el

@@ -6128,10 +6128,14 @@ specification like [h]h:mm."
 				 (memq 'agenda
 				       org-agenda-use-tag-inheritance)))))
 		   (tags (org-get-tags-at nil (not inherited-tags)))
-		   (timestr
-		    (if (string-match " \\([012]?[0-9]:[0-9][0-9]\\)" s)
-			(concat (substring s (match-beginning 1)) " ")
-		      'time))
+		   (time
+		    (cond
+		     ;; No time of day designation if it is only
+		     ;; a reminder.
+		     ((and (/= current deadline) (/= current repeat)) nil)
+		     ((string-match " \\([012]?[0-9]:[0-9][0-9]\\)" s)
+		      (concat (substring s (match-beginning 1)) " "))
+		     (t 'time)))
 		   (item
 		    (org-agenda-format-item
 		     ;; Insert appropriate suffixes before deadlines.
@@ -6149,7 +6153,7 @@ specification like [h]h:mm."
 			(t (format future diff))))
 		     head level category tags
 		     (and (or (= repeat current) (= deadline current))
-			  timestr)))
+			  time)))
 		   (face (org-agenda-deadline-face
 			  (- 1 (/ (float (- deadline current)) (max wdays 1)))))
 		   (upcoming? (and today? (> deadline today)))
@@ -6329,10 +6333,14 @@ scheduled items with an hour specification like [h]h:mm."
 		   (level
 		    (make-string (org-reduced-level (org-outline-level)) ?\s))
 		   (head (buffer-substring (point) (line-end-position)))
-		   (timestr
-		    (if (string-match " \\([012]?[0-9]:[0-9][0-9]\\)" s)
-			(concat (substring s (match-beginning 1)) " ")
-		      'time))
+		   (time
+		    (cond
+		     ;; No time of day designation if it is only
+		     ;; a reminder.
+		     ((and (/= current schedule) (/= current repeat)) nil)
+		     ((string-match " \\([012]?[0-9]:[0-9][0-9]\\)" s)
+		      (concat (substring s (match-beginning 1)) " "))
+		     (t 'time)))
 		   (item
 		    (org-agenda-format-item
 		     (pcase-let ((`(,first ,next) org-agenda-scheduled-leaders))
@@ -6350,7 +6358,7 @@ scheduled items with an hour specification like [h]h:mm."
 			;; Subsequent reminders.  Count from base
 			;; schedule.
 			(t (format next (1+ diff)))))
-		     head level category tags timestr nil habitp))
+		     head level category tags time nil habitp))
 		   (face (cond ((and (not habitp) (< current today))
 				'org-scheduled-previously)
 			       (todayp 'org-scheduled-today)