* Patch: More options for ignoring scheduled items in agenda todo lists
@ 2011-01-13 22:46 Paul Sexton
2011-01-14 12:52 ` Matt Lundin
0 siblings, 1 reply; 6+ messages in thread
From: Paul Sexton @ 2011-01-13 22:46 UTC (permalink / raw)
To: emacs-orgmode
In agenda todo lists, currently it is possible to ignore scheduled
items according to when they are scheduled, using the variable
'org-agenda-todo-ignore-scheduled'. This can take one of three
values - all, future (ignore if scheduled after today), or past
(ignore if scheduled TODAY or in the past).
My definition of 'the past' does not include 'today'.
In light of that, the following is a patch that makes the variable
accept 2 more values:
- notpast: ignore if scheduled today or in the future
- notfuture: ignore if scheduled today or in the past
(this is the current behaviour of the 'past' setting)
- past: changed to ignore if scheduled BEFORE today, but no
longer ignores items scheduled today.
Paul
--- D:/paul/dotemacs/site-lisp/org/lisp/org-agenda.el Mon Dec 13 07:57:31 2010
+++ D:/paul/dotemacs/site-lisp/org/lisp/org-agenda_p.el Fri Jan 14 11:32:23 2011
@@ -598,12 +598,18 @@
This applies when creating the global todo list.
Valid values are:
-past Don't show entries scheduled today or in the past.
+past Don't show entries scheduled in the past.
future Don't show entries scheduled in the future.
The idea behind this is that by scheduling it, you don't want to
think about it until the scheduled date.
+notpast Don't show entries scheduled today or in the
+ future.
+
+notfuture Don't show entries scheduled today or in the
+ past.
+
all Don't show any scheduled entries in the global todo list.
The idea behind this is that by scheduling it, you have already
\"taken care\" of this item.
@@ -4512,8 +4518,12 @@
(cond
((eq org-agenda-todo-ignore-scheduled 'future)
(> (org-days-to-time (match-string 1)) 0))
- ((eq org-agenda-todo-ignore-scheduled 'past)
+ ((eq org-agenda-todo-ignore-scheduled 'past) ; before today
+ (< (org-days-to-time (match-string 1)) 0))
+ ((eq org-agenda-todo-ignore-scheduled 'notfuture)
(<= (org-days-to-time (match-string 1)) 0))
+ ((eq org-agenda-todo-ignore-scheduled 'notpast)
+ (>= (org-days-to-time (match-string 1)) 0))
(t)))
(and org-agenda-todo-ignore-deadlines
(re-search-forward org-deadline-time-regexp end t)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Patch: More options for ignoring scheduled items in agenda todo lists
2011-01-13 22:46 Patch: More options for ignoring scheduled items in agenda todo lists Paul Sexton
@ 2011-01-14 12:52 ` Matt Lundin
[not found] ` <4D30E811.4090508@xnet.co.nz>
0 siblings, 1 reply; 6+ messages in thread
From: Matt Lundin @ 2011-01-14 12:52 UTC (permalink / raw)
To: Paul Sexton; +Cc: emacs-orgmode
Hi Paul,
Paul Sexton <psexton@xnet.co.nz> writes:
> In agenda todo lists, currently it is possible to ignore scheduled
> items according to when they are scheduled, using the variable
> 'org-agenda-todo-ignore-scheduled'. This can take one of three
> values - all, future (ignore if scheduled after today), or past
> (ignore if scheduled TODAY or in the past).
>
> My definition of 'the past' does not include 'today'.
> In light of that, the following is a patch that makes the variable
> accept 2 more values:
> - notpast: ignore if scheduled today or in the future
> - notfuture: ignore if scheduled today or in the past
> (this is the current behaviour of the 'past' setting)
> - past: changed to ignore if scheduled BEFORE today, but no
> longer ignores items scheduled today.
>
I believe this patch would require many users to change their existing
configurations.
I rely on the "past" setting when creating block agenda views, such as
an agenda that includes everything scheduled today or earlier together
with a todo list that includes everything else (i.e., unscheduled or
scheduled in the future). If the definition of past is changed, I will
end up with a lot of duplicate items in the block agenda.
Also, I find the double negatives a bit difficult to get my mind around.
Would there perhaps be a way to generalize this functionality (e.g.,
with integers) that would allow users greater control over the precise
distance from the present they would like to skip? E.g., -1 to include
only items scheduled yesterday or earlier. Or 7 to ignore anything
scheduled later than a week from now. This could be quite useful and
would not require users to change their existing configurations.
Do you also plan to make adjustments for
org-agenda-todo-ignore-deadlines?
Best,
Matt
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Patch: More options for ignoring scheduled items in agenda todo lists
[not found] ` <4D30E811.4090508@xnet.co.nz>
@ 2011-01-15 14:26 ` Matt Lundin
2011-01-17 20:51 ` [PATCH] Add new option for ignoring past or future items in the global todo list Matt Lundin
0 siblings, 1 reply; 6+ messages in thread
From: Matt Lundin @ 2011-01-15 14:26 UTC (permalink / raw)
To: Paul Sexton; +Cc: emacs-orgmode
Paul Sexton <psexton@xnet.co.nz> writes:
> Thanks for your reply Matt.
>> I believe this patch would require many users to change their existing
>> configurations.
>>
>> I rely on the "past" setting when creating block agenda views, such as
>> an agenda that includes everything scheduled today or earlier together
>> with a todo list that includes everything else (i.e., unscheduled or
>> scheduled in the future). If the definition of past is changed, I will
>> end up with a lot of duplicate items in the block agenda.
>>
> You just need to change 'past' to 'notfuture'. 'Past' is not an
> accurate description of the behaviour of the setting -- it actually
> ignores past+present, and there is no way to only ignore past items.
Linguistic precision notwithstanding, my recommendation would be to
defer to convention here. Of course, I also defer to the maintainer. :)
According to the docstrings for org-agenda-todo-ignore-deadlines and
org-agenda-todo-ignore-scheduled, the definition of "past" includes
today:
,----
| past Don't show entries scheduled today or in the past.
| past Don't show entries with a deadline timestamp for today or in the past.
`----
I suppose my chief question is whether it would be possible to preserve
the current behavior of "past", while introducing a new setting to
accommodate the functionality you seek (e.g., "old" or, better yet,
integers)?
> Development of org mode often introduces incompatibilities with older
> versions. These are generally well highlighted in the release notes.
> All this change would require is for users to change 'past' to
> 'notfuture' when using this variable.
Indeed, it is relatively easy to change the settings with a search and
replace. Somewhat harder is catching all such changes in the release
notes. ;)
My concern has to do with the precedent this sets. I would submit that
incompatibilities be introduced only with the utmost caution and in
cases of clear need. If I remember correctly, obsoleted settings and
variables are usually gracefully deprecated (e.g., org-agenda-span vs.
org-agenda-ndays). If each release contains multiple small breakages
because individual users would like to change conventional naming, it
can become difficult to keep up with org-development. Of course, such
decisions are in the hands of the Bastien and Carsten.
> I just want to extend and logicalise' the functionality of this
> variable.
What do you think of the possibility of using positive and negative
integers (e.g., -1 for past only, 1 for future only, -7 for anything a
week or more in the past, 14 for anything two weeks or more in the
future, and so on)? Would that perhaps be a way to add some
comprehensive logic and fine-grained control to this setting? I'd be
happy to work up a patch to that effect.
Thanks for taking the time to respond to my questions!
Best,
Matt
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] Add new option for ignoring past or future items in the global todo list
2011-01-15 14:26 ` Matt Lundin
@ 2011-01-17 20:51 ` Matt Lundin
2011-01-18 0:46 ` Paul Sexton
2011-01-26 10:00 ` [Accepted] " Carsten Dominik
0 siblings, 2 replies; 6+ messages in thread
From: Matt Lundin @ 2011-01-17 20:51 UTC (permalink / raw)
To: Paul Sexton; +Cc: emacs-orgmode
* 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
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] Add new option for ignoring past or future items in the global todo list
2011-01-17 20:51 ` [PATCH] Add new option for ignoring past or future items in the global todo list Matt Lundin
@ 2011-01-18 0:46 ` Paul Sexton
2011-01-26 10:00 ` [Accepted] " Carsten Dominik
1 sibling, 0 replies; 6+ messages in thread
From: Paul Sexton @ 2011-01-18 0:46 UTC (permalink / raw)
To: emacs-orgmode
Matt Lundin <mdl <at> imapmail.org> writes:
[snip]
Thanks Matt! (And it was mostly your idea.)
Paul
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Accepted] Add new option for ignoring past or future items in the global todo list
2011-01-17 20:51 ` [PATCH] Add new option for ignoring past or future items in the global todo list Matt Lundin
2011-01-18 0:46 ` Paul Sexton
@ 2011-01-26 10:00 ` Carsten Dominik
1 sibling, 0 replies; 6+ messages in thread
From: Carsten Dominik @ 2011-01-26 10:00 UTC (permalink / raw)
To: emacs-orgmode
Patch 545 (http://patchwork.newartisans.com/patch/545/) is now "Accepted".
Maintainer comment: none
This relates to the following submission:
http://mid.gmane.org/%3C8739orgso1.fsf_-_%40fastmail.fm%3E
Here is the original message containing the patch:
> Content-Type: text/plain; charset="utf-8"
> MIME-Version: 1.0
> Content-Transfer-Encoding: 7bit
> Subject: [Orgmode] Add new option for ignoring past or future items in the
> global todo list
> Date: Tue, 18 Jan 2011 01:51:42 -0000
> From: Matt Lundin <mdl@imapmail.org>
> X-Patchwork-Id: 545
> Message-Id: <8739orgso1.fsf_-_@fastmail.fm>
> To: Paul Sexton <psexton@xnet.co.nz>
> Cc: emacs-orgmode@gnu.org
>
> * 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
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-01-26 10:00 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-13 22:46 Patch: More options for ignoring scheduled items in agenda todo lists Paul Sexton
2011-01-14 12:52 ` Matt Lundin
[not found] ` <4D30E811.4090508@xnet.co.nz>
2011-01-15 14:26 ` Matt Lundin
2011-01-17 20:51 ` [PATCH] Add new option for ignoring past or future items in the global todo list Matt Lundin
2011-01-18 0:46 ` Paul Sexton
2011-01-26 10:00 ` [Accepted] " Carsten Dominik
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).