* lisp/org-agenda.el: (org-agenda-todo-ignore-deadlines): New option. (org-agenda-todo-ignore-scheduled): New option. (org-agenda-todo-ignore-timestamp): New option. (org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item): Allow user to specify custom distance to ignore (future or past). (org-agenda-todo-custom-ignore-p): New function.
This patch gives users greater control over which past or future items they would like to ignore in the global todo list. By setting org-agenda-todo-ignore-scheduled to 7, for instance, a user can ignore all items scheduled 7 or more days in the future. Similarly, by setting org-agenda-todo-ignore-scheduled to -1, a user can ignore all items that are truly in the past (unlike the 'past setting, which ignores items scheduled today). Thanks to Paul Sexton for the idea for this new functionality. --- lisp/org-agenda.el | 42 +++++++++++++++++++++++++++++++++++++++--- 1 files changed, 39 insertions(+), 3 deletions(-) diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index 0cd620c..68e781a 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -599,6 +599,14 @@ all Don't show any entries with a timestamp in the global todo list. The idea behind this is that by setting a timestamp, you have already \"taken care\" of this item. +This variable can also have an integer as a value. If positive (N), +todos with a timestamp N or more days in the future will be ignored. If +negative (-N), todos with a timestamp N or more days in the past will be +ignored. If 0, todos with a timestamp either today or in the future will +be ignored. For example, a value of -1 will exclude todos with a +timestamp in the past (yesterday or earlier), while a value of 7 will +exclude todos with a timestamp a week or more in the future. + See also `org-agenda-todo-ignore-with-date'. See also the variable `org-agenda-tags-todo-honor-ignore-options' if you want to make his option also apply to the tags-todo list." @@ -608,7 +616,8 @@ to make his option also apply to the tags-todo list." (const :tag "Ignore future timestamp todos" future) (const :tag "Ignore past or present timestamp todos" past) (const :tag "Ignore all timestamp todos" all) - (const :tag "Show timestamp todos" nil))) + (const :tag "Show timestamp todos" nil) + (integer :tag "Ignore if N or more days in past(-) or future(+)."))) (defcustom org-agenda-todo-ignore-scheduled nil "Non-nil means, ignore some scheduled TODO items when making TODO list. @@ -627,6 +636,9 @@ all Don't show any scheduled entries in the global todo list. t Same as `all', for backward compatibility. +This variable can also have an integer as a value. See +`org-agenda-todo-ignore-timestamp' for more details. + See also `org-agenda-todo-ignore-with-date'. See also the variable `org-agenda-tags-todo-honor-ignore-options' if you want to make his option also apply to the tags-todo list." @@ -637,7 +649,8 @@ to make his option also apply to the tags-todo list." (const :tag "Ignore past- or present-scheduled todos" past) (const :tag "Ignore all scheduled todos" all) (const :tag "Ignore all scheduled todos (compatibility)" t) - (const :tag "Show scheduled todos" nil))) + (const :tag "Show scheduled todos" nil) + (integer :tag "Ignore if N or more days in past(-) or future(+)."))) (defcustom org-agenda-todo-ignore-deadlines nil "Non-nil means ignore some deadlined TODO items when making TODO list. @@ -664,6 +677,9 @@ all Ignore all TODO entries that do have a deadline. t Same as `near', for backward compatibility. +This variable can also have an integer as a value. See +`org-agenda-todo-ignore-timestamp' for more details. + See also `org-agenda-todo-ignore-with-date'. See also the variable `org-agenda-tags-todo-honor-ignore-options' if you want to make his option also apply to the tags-todo list." @@ -674,7 +690,8 @@ to make his option also apply to the tags-todo list." (const :tag "Ignore near deadlines (compatibility)" t) (const :tag "Ignore far deadlines" far) (const :tag "Ignore all TODOs with a deadlines" all) - (const :tag "Show all TODOs, even if they have a deadline" nil))) + (const :tag "Show all TODOs, even if they have a deadline" nil) + (integer :tag "Ignore if N or more days in past(-) or future(+)."))) (defcustom org-agenda-tags-todo-honor-ignore-options nil "Non-nil means honor todo-list ...ignore options also in tags-todo search. @@ -4537,6 +4554,16 @@ the documentation of `org-diary'." (org-end-of-subtree 'invisible)))) (nreverse ee))) +(defun org-agenda-todo-custom-ignore-p (time n) + "Check whether timestamp is farther away then n number of days. +This function is invoked if `org-agenda-todo-ignore-deadlines', +`org-agenda-todo-ignore-scheduled' or +`org-agenda-todo-ignore-timestamp' is set to an integer." + (let ((days (org-days-to-time time))) + (if (>= n 0) + (>= days n) + (<= days n)))) + ;;;###autoload (defun org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item (&optional end) @@ -4556,6 +4583,9 @@ the documentation of `org-diary'." (> (org-days-to-time (match-string 1)) 0)) ((eq org-agenda-todo-ignore-scheduled 'past) (<= (org-days-to-time (match-string 1)) 0)) + ((numberp org-agenda-todo-ignore-scheduled) + (org-agenda-todo-custom-ignore-p + (match-string 1) org-agenda-todo-ignore-scheduled)) (t))) (and org-agenda-todo-ignore-deadlines (re-search-forward org-deadline-time-regexp end t) @@ -4567,6 +4597,9 @@ the documentation of `org-diary'." (> (org-days-to-time (match-string 1)) 0)) ((eq org-agenda-todo-ignore-deadlines 'past) (<= (org-days-to-time (match-string 1)) 0)) + ((numberp org-agenda-todo-ignore-deadlines) + (org-agenda-todo-custom-ignore-p + (match-string 1) org-agenda-todo-ignore-deadlines)) (t (org-deadline-close (match-string 1))))) (and org-agenda-todo-ignore-timestamp (let ((buffer (current-buffer)) @@ -4589,6 +4622,9 @@ the documentation of `org-diary'." (> (org-days-to-time (match-string 1)) 0)) ((eq org-agenda-todo-ignore-timestamp 'past) (<= (org-days-to-time (match-string 1)) 0)) + ((numberp org-agenda-todo-ignore-timestamp) + (org-agenda-todo-custom-ignore-p + (match-string 1) org-agenda-todo-ignore-timestamp)) (t)))))))))) (defconst org-agenda-no-heading-message -- 1.7.3.5 _______________________________________________ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode