summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Dominik <carsten.dominik@gmail.com>2010-02-17 22:46:02 +0100
committerCarsten Dominik <carsten.dominik@gmail.com>2010-02-17 23:01:15 +0100
commit8d6aa8f3df39ed15a0c825f4a20a3bc1250bed4d (patch)
tree847921c3492daf1351a45ef1cf2b04a6332e21e8
parent0c397ae5f476cefdc87d0ffc32b300b5081419b0 (diff)
downloadorg-mode-8d6aa8f3df39ed15a0c825f4a20a3bc1250bed4d.tar.gz
Agenda: Allow to suppress deadline warnings for entries also scheduled
-rwxr-xr-xlisp/ChangeLog3
-rw-r--r--lisp/org-agenda.el34
2 files changed, 36 insertions, 1 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 7cd6bda..4d4dfcc 100755
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -2,6 +2,9 @@
* org-agenda.el (org-search-view): Fix bug with searching full
words in headlines in search view.
+ (org-agenda-skip-deadline-prewarning-if-scheduled): New option.
+ (org-agenda-get-deadlines): Suppress pre-warning if the entry is
+ scheduled (if the user configures it so.
2010-02-16 Carsten Dominik <carsten.dominik@gmail.com>
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 90a32b6..8bfbef4 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -641,6 +641,24 @@ deadlines are always turned off when the item is DONE."
:group 'org-agenda-daily/weekly
:type 'boolean)
+(defcustom org-agenda-skip-deadline-prewarning-if-scheduled nil
+ "Non-nil means skip deadline prewarning when entry is also scheduled.
+This will apply on all days where a prewarning for the deadline would
+be shown, but not at the day when the entry is actually due. On that day,
+the deadline will be shown anyway.
+This variable may be set to nil, t, or a number which will then give
+the number of days before the actual deadline when the prewarnings
+should resume.
+This can be used in a workflow where the first showing of the deadline will
+trigger you to schedule it, and then you don't want to be reminded of it
+because you will take care of it on the day when scheduled."
+ :group 'org-agenda-skip
+ :group 'org-agenda-daily/weekly
+ :type '(choice
+ (const :tag "Alwas show prewarning" nil)
+ (const :tag "Remove prewarning if entry is scheduled" t)
+ (integer :tag "Restart prewarning N days before deadline")))
+
(defcustom org-agenda-skip-additional-timestamps-same-entry t
"When nil, multiple same-day timestamps in entry make multiple agenda lines.
When non-nil, after the search for timestamps has matched once in an
@@ -4400,11 +4418,22 @@ be skipped."
(todayp (org-agenda-todayp date)) ; DATE bound by calendar
(d1 (calendar-absolute-from-gregorian date)) ; DATE bound by calendar
d2 diff dfrac wdays pos pos1 category tags
+ suppress-prewarning
ee txt head face s todo-state upcomingp donep timestr)
(goto-char (point-min))
(while (re-search-forward regexp nil t)
+ (setq suppress-prewarning nil)
(catch :skip
(org-agenda-skip)
+ (when (and org-agenda-skip-deadline-prewarning-if-scheduled
+ (save-match-data
+ (string-match org-scheduled-time-regexp
+ (buffer-substring (point-at-bol)
+ (point-at-eol)))))
+ (setq suppress-prewarning
+ (if (integerp org-agenda-skip-deadline-prewarning-if-scheduled)
+ org-agenda-skip-deadline-prewarning-if-scheduled
+ 0)))
(setq s (match-string 1)
txt nil
pos (1- (match-beginning 1))
@@ -4412,7 +4441,10 @@ be skipped."
(match-string 1) d1 'past
org-agenda-repeating-timestamp-show-all)
diff (- d2 d1)
- wdays (org-get-wdays s)
+ wdays (if suppress-prewarning
+ (let ((org-deadline-warning-days suppress-prewarning))
+ (org-get-wdays s))
+ (org-get-wdays s))
dfrac (/ (* 1.0 (- wdays diff)) (max wdays 1))
upcomingp (and todayp (> diff 0)))
;; When to show a deadline in the calendar: