emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Carsten Dominik <cdominik@newartisans.com>
To: emacs-orgmode@gnu.org
Subject: [Accepted] Add new option for ignoring past or future items in the global todo list
Date: Wed, 26 Jan 2011 11:00:13 +0100 (CET)	[thread overview]
Message-ID: <20110126100013.972F6953CF8@u016822.science.uva.nl> (raw)
In-Reply-To: 8739orgso1.fsf_-_@fastmail.fm

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
> 

      parent reply	other threads:[~2011-01-26 10:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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         ` Carsten Dominik [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110126100013.972F6953CF8@u016822.science.uva.nl \
    --to=cdominik@newartisans.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).