Переглянути джерело

org-agenda.el (org-agenda-skip-scheduled-if-deadline-is-shown): New allowed value `repeated-after-deadline'

* org-agenda.el (org-agenda-skip-scheduled-if-deadline-is-shown):
New allowed value `repeated-after-deadline' which will prevent the
display of scheduled items when repeated after the current
deadline.
(org-agenda-get-scheduled): Handle the new value.

This allows this task

* Do me every day before March, 16th (included)
  SCHEDULED: <2013-03-12 mar. +1d> DEADLINE: <2013-03-16 sam.>

to step being displayed after March, 16th.

Thanks a lot to Rick Hanson for coming with this idea and a clear example.
Bastien Guerry 12 роки тому
батько
коміт
742f473820
1 змінених файлів з 23 додано та 10 видалено
  1. 23 10
      lisp/org-agenda.el

+ 23 - 10
lisp/org-agenda.el

@@ -789,20 +789,29 @@ is DONE."
 
 (defcustom org-agenda-skip-scheduled-if-deadline-is-shown nil
   "Non-nil means skip scheduling line if same entry shows because of deadline.
-In the agenda of today, an entry can show up multiple times because
-it is both scheduled and has a nearby deadline, and maybe a plain time
-stamp as well.
-When this variable is t, then only the deadline is shown and the fact that
-the entry is scheduled today or was scheduled previously is not shown.
-When this variable is nil, the entry will be shown several times.  When
-the variable is the symbol `not-today', then skip scheduled previously,
-but not scheduled today."
+
+In the agenda of today, an entry can show up multiple times
+because it is both scheduled and has a nearby deadline, and maybe
+a plain time stamp as well.
+
+When this variable is nil, the entry will be shown several times.
+
+When set to t, then only the deadline is shown and the fact that
+the entry is scheduled today or was scheduled previously is not
+shown.
+
+When set to the symbol `not-today', skip scheduled previously,
+but not scheduled today.
+
+When set to the symbol `repeated-after-deadline', skip scheduled
+items if they are repeated beyond the current dealine."
   :group 'org-agenda-skip
   :group 'org-agenda-daily/weekly
   :type '(choice
 	  (const :tag "Never" nil)
 	  (const :tag "Always" t)
-	  (const :tag "Not when scheduled today" not-today)))
+	  (const :tag "Not when scheduled today" not-today)
+	  (const :tag "When repeated past deadline" repeated-after-deadline)))
 
 (defcustom org-agenda-skip-timestamp-if-deadline-is-shown nil
   "Non-nil means skip timestamp line if same entry shows because of deadline.
@@ -6113,6 +6122,10 @@ FRACTION is what fraction of the head-warning time has passed."
 				  (org-is-habit-p))))
 	      (setq category (org-get-category)
 		    category-pos (get-text-property (point) 'org-category-position))
+	      (if (and (eq org-agenda-skip-scheduled-if-deadline-is-shown
+			   'repeated-after-deadline)
+		       (<= 0 (- d2 (time-to-days (org-get-deadline-time (point))))))
+		  (throw :skip nil))
 	      (if (not (re-search-backward "^\\*+[ \t]+" nil t))
 		  (throw :skip nil)
 		(goto-char (match-end 0))
@@ -6125,7 +6138,7 @@ FRACTION is what fraction of the head-warning time has passed."
 			(throw :skip nil))
 		  (if (and
 		       (or (eq t org-agenda-skip-scheduled-if-deadline-is-shown)
-			   (and org-agenda-skip-scheduled-if-deadline-is-shown
+			   (and (eq org-agenda-skip-scheduled-if-deadline-is-shown 'not-today)
 				pastschedp))
 		       (setq mm (assoc pos1 deadline-position-alist)))
 		      (throw :skip nil)))