emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Agenda todo filter order
@ 2011-04-20  0:33 Bernt Hansen
  2011-04-20  0:39 ` Bernt Hansen
  0 siblings, 1 reply; 10+ messages in thread
From: Bernt Hansen @ 2011-04-20  0:33 UTC (permalink / raw)
  To: carsten.dominik; +Cc: emacs-orgmode

Hi Carsten,

I'm trying to tune my shiny new block agenda so it has a section that
displays non-project tasks without a scheduled date or deadline date in
the future.

I have a non-standard skipping function that skips project trees which
I'm using in this agenda so what is left should only be non-project
tasks.  My agenda with only this non-standard skipping function works
perfectly and gives me a list of only non-project tasks.

I don't really want to see non-project tasks with a scheduled or
deadline date in the future.  I added org-agenda-todo-ignore-scheduled
and org-agenda-todo-ignore-deadlines to 'future to this agenda view and
now I get extra project tasks in the list which is incorrect.

It seems the org-agenda-todo-ignore-scheduled (and deadlines) vars are
applied to the list of todo tasks first -- so any projects that have a
scheduled or deadline date are skipped (but not the entire tree - just
the top-level project task) -- this makes all of the project subtasks
appear in my 'non-project' task list which is wrong.

If the non-standard skipping function was applied first and then the
test for scheduled/deadline I think it work work the way I want.  Is
this hard to change?

Example:

* TODO Project task
** TODO Subtask 1
** TODO Subtask 2
* TODO Non project task
* TODO Another non-project-task
* TODO Some future non-project task

[2011-04-19 Tue 20:33]
[2011-04-19 Tue 20:33]
[2011-04-19 Tue 20:33]
[2011-04-19 Tue 20:33]
[2011-04-19 Tue 20:33]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Agenda todo filter order
  2011-04-20  0:33 Agenda todo filter order Bernt Hansen
@ 2011-04-20  0:39 ` Bernt Hansen
  2011-05-06  6:24   ` Carsten Dominik
  0 siblings, 1 reply; 10+ messages in thread
From: Bernt Hansen @ 2011-04-20  0:39 UTC (permalink / raw)
  To: carsten.dominik; +Cc: emacs-orgmode

<Sorry for the double post - hit C-c C-s in Gnus trying to set the
 scheduled date and that sends the message... oops>

Hi Carsten,

I'm trying to tune my shiny new block agenda so it has a section that
displays non-project tasks without a scheduled date or deadline date in
the future.

I have a non-standard skipping function that skips project trees which
I'm using in this agenda so what is left should only be non-project
tasks.  My agenda with only this non-standard skipping function works
perfectly and gives me a list of only non-project tasks.

I don't really want to see non-project tasks with a scheduled or
deadline date in the future.  I added org-agenda-todo-ignore-scheduled
and org-agenda-todo-ignore-deadlines to 'future to this agenda view and
now I get extra project tasks in the list which is incorrect.

It seems the org-agenda-todo-ignore-scheduled (and deadlines) vars are
applied to the list of todo tasks first -- so any projects that have a
scheduled or deadline date are skipped (but not the entire tree - just
the top-level project task) -- this makes all of the project subtasks
appear in my 'non-project' task list which is wrong.

If the non-standard skipping function was applied first and then the
test for scheduled/deadline I think it work work the way I want.  Is
this hard to change?

Example:

--8<---------------cut here---------------start------------->8---
* TODO Project task
  SCHEDULED: <2011-04-12 Tue>
** TODO Subtask 1
** TODO Subtask 2
* TODO Non project task
* TODO Another non-project-task
  DEADLINE: <2011-06-03 Fri>
* TODO Some future non-project task
  SCHEDULED: <2011-06-18 Sat>
--8<---------------cut here---------------end--------------->8---

My agenda view for non-project tasks should show only

* TODO Non project task
* TODO Another non-project-task
* TODO Some future non-project task

but with (setq org-agenda-todo-ignore-scheduled 'future) the top level
'Project task' is skipped and 'Subtask 1' show up (and is considered not
a project since it has no subtasks)

If this can't be changed for some technical reason I guess I can make my
skipping function more intelligent and look up the hierarchy as well to
make sure this task is not under some other project task but I didn't
think that would be necessary to accomplish what I want.

Do you have any suggestions for how I get to my desired end result?

Regards,
Bernt

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Agenda todo filter order
  2011-04-20  0:39 ` Bernt Hansen
@ 2011-05-06  6:24   ` Carsten Dominik
  2011-05-06 17:40     ` Bernt Hansen
  0 siblings, 1 reply; 10+ messages in thread
From: Carsten Dominik @ 2011-05-06  6:24 UTC (permalink / raw)
  To: Bernt Hansen; +Cc: emacs-orgmode

Hi Bernt,

I don't see a compelling reason why these two skipping checks could not
be exchanged:
-----------------------------------------------------------------------------------
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 609edd4..a386a18 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -4573,6 +4573,7 @@ the documentation of `org-diary'."
     (goto-char (point-min))
     (while (re-search-forward regexp nil t)
       (catch :skip
+	(org-agenda-skip)
 	(save-match-data
 	  (beginning-of-line)
 	  (setq beg (point) end (save-excursion (outline-next-heading) (point)))
@@ -4581,7 +4582,6 @@ the documentation of `org-diary'."
 	    (or org-agenda-todo-list-sublevels (org-end-of-subtree 'invisible))
 	    (throw :skip nil)))
 	(goto-char beg)
-	(org-agenda-skip)
 	(goto-char (match-beginning 1))
 	(setq marker (org-agenda-new-marker (match-beginning 0))
 	      category (org-get-category)
-----------------------------------------------------------------------------------

Does anyone else see a reason why this could cause a problem?

Bernt, maybe just try out this patch and report back?

- Carsten


On 20.4.2011, at 02:39, Bernt Hansen wrote:

> <Sorry for the double post - hit C-c C-s in Gnus trying to set the
> scheduled date and that sends the message... oops>
> 
> Hi Carsten,
> 
> I'm trying to tune my shiny new block agenda so it has a section that
> displays non-project tasks without a scheduled date or deadline date in
> the future.
> 
> I have a non-standard skipping function that skips project trees which
> I'm using in this agenda so what is left should only be non-project
> tasks.  My agenda with only this non-standard skipping function works
> perfectly and gives me a list of only non-project tasks.
> 
> I don't really want to see non-project tasks with a scheduled or
> deadline date in the future.  I added org-agenda-todo-ignore-scheduled
> and org-agenda-todo-ignore-deadlines to 'future to this agenda view and
> now I get extra project tasks in the list which is incorrect.
> 
> It seems the org-agenda-todo-ignore-scheduled (and deadlines) vars are
> applied to the list of todo tasks first -- so any projects that have a
> scheduled or deadline date are skipped (but not the entire tree - just
> the top-level project task) -- this makes all of the project subtasks
> appear in my 'non-project' task list which is wrong.
> 
> If the non-standard skipping function was applied first and then the
> test for scheduled/deadline I think it work work the way I want.  Is
> this hard to change?
> 
> Example:
> 
> --8<---------------cut here---------------start------------->8---
> * TODO Project task
>  SCHEDULED: <2011-04-12 Tue>
> ** TODO Subtask 1
> ** TODO Subtask 2
> * TODO Non project task
> * TODO Another non-project-task
>  DEADLINE: <2011-06-03 Fri>
> * TODO Some future non-project task
>  SCHEDULED: <2011-06-18 Sat>
> --8<---------------cut here---------------end--------------->8---
> 
> My agenda view for non-project tasks should show only
> 
> * TODO Non project task
> * TODO Another non-project-task
> * TODO Some future non-project task
> 
> but with (setq org-agenda-todo-ignore-scheduled 'future) the top level
> 'Project task' is skipped and 'Subtask 1' show up (and is considered not
> a project since it has no subtasks)
> 
> If this can't be changed for some technical reason I guess I can make my
> skipping function more intelligent and look up the hierarchy as well to
> make sure this task is not under some other project task but I didn't
> think that would be necessary to accomplish what I want.
> 
> Do you have any suggestions for how I get to my desired end result?
> 
> Regards,
> Bernt

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: Agenda todo filter order
  2011-05-06  6:24   ` Carsten Dominik
@ 2011-05-06 17:40     ` Bernt Hansen
  2011-05-08  6:03       ` Carsten Dominik
  0 siblings, 1 reply; 10+ messages in thread
From: Bernt Hansen @ 2011-05-06 17:40 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode

Hi Carsten,

Thanks for the patch!  This almost does what I want :)

This patch works for TODO agendas but not tags match agendas which is
what I am trying to use.

C-c a y returns the result I want
C-c a x should be identical and is not.


,----[ C-c a y ]
| Non Project TODO Tasks
|   test:       TODO Single Task
|   test:       TODO Task Three
|   test:       TODO Task Four
`----

,----[ C-c a x ]
| Non Project Tasks
|   test:       TODO Single Task
|   test:       TODO Subtask Four
|   test:       TODO Subtask Five
|   test:       TODO Subtask Six
|   test:       TODO Subtask Seven
|   test:       TODO Subtask Eight
|   test:       TODO Subtask Nine
|   test:       TODO Task Three
|   test:       TODO Task Four
`----


Below is the minimal emacs setup which I'm using to test:

Regards,
Bernt

~/bin/minimal-emacs
--8<---------------cut here---------------start------------->8---
#!/bin/sh
TESTEL=
TESTFILE=/tmp/test.el
if test -e $TESTFILE
then
  TESTEL="-l /tmp/test.el"
fi
emacs -q -l ~/minimal.emacs $TESTEL $1
--8<---------------cut here---------------end--------------->8---

~/minimal.emacs
--8<---------------cut here---------------start------------->8---
(add-to-list 'load-path (expand-file-name "~/git/org-mode/lisp"))
(add-to-list 'auto-mode-alist '("\\.\\(org\\|org_archive\\|txt\\)$" . org-mode))
(require 'org-install)

(global-set-key "\C-cl" 'org-store-link)
(global-set-key "\C-ca" 'org-agenda)
(global-set-key "\C-cb" 'org-iswitchb)
--8<---------------cut here---------------end--------------->8---

/tmp/test.el
--8<---------------cut here---------------start------------->8---
(setq org-agenda-files (list "/tmp/test.org"))
(setq org-agenda-todo-ignore-scheduled t)
(setq org-agenda-todo-ignore-deadlines t)
(setq org-agenda-tags-todo-honor-ignore-options t)
(setq org-agenda-custom-commands (quote (("x" "Non-Project Tasks" tags-todo "/!"
					  ((org-agenda-overriding-header "Non Project Tasks")
					   (org-agenda-skip-function 'bh/skip-project-trees)))
					 ("y" "Non-Project TODO Tasks" todo ""
					  ((org-agenda-overriding-header "Non Project TODO Tasks")
					   (org-agenda-skip-function 'bh/skip-project-trees))))))

(defun bh/is-subproject-p ()
  "Any task which is a subtask of another project"
  (let ((is-subproject)
	(is-a-task (member (nth 2 (org-heading-components)) org-todo-keywords-1)))
    (save-excursion
      (while (and (not is-subproject) (org-up-heading-safe))
	(when (member (nth 2 (org-heading-components)) org-todo-keywords-1)
	  (setq is-subproject t))))
    (and is-a-task is-subproject)))

(defun bh/is-project-p ()
  "Any task with a todo keyword subtask and is not a subtask of another project
This does not support projects with subprojects"
  (let ((has-subtask)
	(subtree-end (save-excursion (org-end-of-subtree t)))
	(is-subproject (bh/is-subproject-p))
	(is-a-task (member (nth 2 (org-heading-components)) org-todo-keywords-1)))
    (save-excursion
      (forward-line 1)
      (while (and (not has-subtask)
		  (< (point) subtree-end)
		  (re-search-forward "^\*+ " subtree-end t))
	(when (member (org-get-todo-state) org-todo-keywords-1)
	  (setq has-subtask t))))
    (and is-a-task has-subtask (not is-subproject))))

(defun bh/skip-project-trees ()
  "Skip trees that are projects"
  (let ((subtree-end (save-excursion (org-end-of-subtree t))))
    (cond
     ((bh/is-project-p)
      subtree-end)
     (t
      nil))))

--8<---------------cut here---------------end--------------->8---

/tmp/test.org
--8<---------------cut here---------------start------------->8---
* TODO Single Task
* TODO Project One
** TODO Subtask One
** TODO Subtask Two
** TODO Subtask Three
* TODO Project Two
  DEADLINE: <2011-05-13 Fri>
** TODO Subtask Four
** TODO Subtask Five
** TODO Subtask Six
* TODO Project Three
  SCHEDULED: <2011-05-08 Sun>
** TODO Subtask Seven
** TODO Subtask Eight
** TODO Subtask Nine
* Tasks
** TODO Task One
   DEADLINE: <2011-05-20 Fri>
** TODO Task Two
   SCHEDULED: <2011-05-13 Fri>
** TODO Task Three
** TODO Task Four
--8<---------------cut here---------------end--------------->8---


Carsten Dominik <carsten.dominik@gmail.com> writes:

> Hi Bernt,
>
> I don't see a compelling reason why these two skipping checks could not
> be exchanged:
> -----------------------------------------------------------------------------------
> diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
> index 609edd4..a386a18 100644
> --- a/lisp/org-agenda.el
> +++ b/lisp/org-agenda.el
> @@ -4573,6 +4573,7 @@ the documentation of `org-diary'."
>      (goto-char (point-min))
>      (while (re-search-forward regexp nil t)
>        (catch :skip
> +	(org-agenda-skip)
>  	(save-match-data
>  	  (beginning-of-line)
>  	  (setq beg (point) end (save-excursion (outline-next-heading) (point)))
> @@ -4581,7 +4582,6 @@ the documentation of `org-diary'."
>  	    (or org-agenda-todo-list-sublevels (org-end-of-subtree 'invisible))
>  	    (throw :skip nil)))
>  	(goto-char beg)
> -	(org-agenda-skip)
>  	(goto-char (match-beginning 1))
>  	(setq marker (org-agenda-new-marker (match-beginning 0))
>  	      category (org-get-category)
> -----------------------------------------------------------------------------------
>
> Does anyone else see a reason why this could cause a problem?
>
> Bernt, maybe just try out this patch and report back?
>
> - Carsten
>
>
> On 20.4.2011, at 02:39, Bernt Hansen wrote:
>
>> <Sorry for the double post - hit C-c C-s in Gnus trying to set the
>> scheduled date and that sends the message... oops>
>> 
>> Hi Carsten,
>> 
>> I'm trying to tune my shiny new block agenda so it has a section that
>> displays non-project tasks without a scheduled date or deadline date in
>> the future.
>> 
>> I have a non-standard skipping function that skips project trees which
>> I'm using in this agenda so what is left should only be non-project
>> tasks.  My agenda with only this non-standard skipping function works
>> perfectly and gives me a list of only non-project tasks.
>> 
>> I don't really want to see non-project tasks with a scheduled or
>> deadline date in the future.  I added org-agenda-todo-ignore-scheduled
>> and org-agenda-todo-ignore-deadlines to 'future to this agenda view and
>> now I get extra project tasks in the list which is incorrect.
>> 
>> It seems the org-agenda-todo-ignore-scheduled (and deadlines) vars are
>> applied to the list of todo tasks first -- so any projects that have a
>> scheduled or deadline date are skipped (but not the entire tree - just
>> the top-level project task) -- this makes all of the project subtasks
>> appear in my 'non-project' task list which is wrong.
>> 
>> If the non-standard skipping function was applied first and then the
>> test for scheduled/deadline I think it work work the way I want.  Is
>> this hard to change?
>> 
>> Example:
>> 
>> --8<---------------cut here---------------start------------->8---
>> * TODO Project task
>>  SCHEDULED: <2011-04-12 Tue>
>> ** TODO Subtask 1
>> ** TODO Subtask 2
>> * TODO Non project task
>> * TODO Another non-project-task
>>  DEADLINE: <2011-06-03 Fri>
>> * TODO Some future non-project task
>>  SCHEDULED: <2011-06-18 Sat>
>> --8<---------------cut here---------------end--------------->8---
>> 
>> My agenda view for non-project tasks should show only
>> 
>> * TODO Non project task
>> * TODO Another non-project-task
>> * TODO Some future non-project task
>> 
>> but with (setq org-agenda-todo-ignore-scheduled 'future) the top level
>> 'Project task' is skipped and 'Subtask 1' show up (and is considered not
>> a project since it has no subtasks)
>> 
>> If this can't be changed for some technical reason I guess I can make my
>> skipping function more intelligent and look up the hierarchy as well to
>> make sure this task is not under some other project task but I didn't
>> think that would be necessary to accomplish what I want.
>> 
>> Do you have any suggestions for how I get to my desired end result?
>> 
>> Regards,
>> Bernt

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Agenda todo filter order
  2011-05-06 17:40     ` Bernt Hansen
@ 2011-05-08  6:03       ` Carsten Dominik
  2011-05-08 14:49         ` Bernt Hansen
  2011-05-08 15:55         ` Bernt Hansen
  0 siblings, 2 replies; 10+ messages in thread
From: Carsten Dominik @ 2011-05-08  6:03 UTC (permalink / raw)
  To: Bernt Hansen; +Cc: emacs-orgmode


On 6.5.2011, at 19:40, Bernt Hansen wrote:

> Hi Carsten,
> 
> Thanks for the patch!  This almost does what I want :)
> 
> This patch works for TODO agendas but not tags match agendas which is
> what I am trying to use.
> 
> C-c a y returns the result I want
> C-c a x should be identical and is not.


Hi Bernt,

here is a patch to *replace* the other patch I sent earlier.  This one
should also work for tags-todo searches....

Completely untested......

Changes at master
	Modified lisp/org-agenda.el
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 609edd4..84e3247 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -4575,13 +4575,12 @@ the documentation of `org-diary'."
       (catch :skip
 	(save-match-data
 	  (beginning-of-line)
+	  (org-agenda-skip)
 	  (setq beg (point) end (save-excursion (outline-next-heading) (point)))
 	  (when (org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item end)
 	    (goto-char (1+ beg))
 	    (or org-agenda-todo-list-sublevels (org-end-of-subtree 'invisible))
 	    (throw :skip nil)))
-	(goto-char beg)
-	(org-agenda-skip)
 	(goto-char (match-beginning 1))
 	(setq marker (org-agenda-new-marker (match-beginning 0))
 	      category (org-get-category)
	Modified lisp/org.el
diff --git a/lisp/org.el b/lisp/org.el
index acbb261..a9dcf46 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -12437,17 +12437,30 @@ only lines with a TODO keyword are included in the output."
 	    ;; selective inheritance, remove uninherited ones
 	    (setcdr (car tags-alist)
 		    (org-remove-uninherited-tags (cdar tags-alist))))
-	  (when (and (or (not todo-only)
-			 (and (member todo org-not-done-keywords)
-			      (or (not org-agenda-tags-todo-honor-ignore-options)
-				  (not (org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item)))))
-		     (let ((case-fold-search t)) (eval matcher))
-		     (or
-		      (not (member org-archive-tag tags-list))
-		      ;; we have an archive tag, should we use this anyway?
-		      (or (not org-agenda-skip-archived-trees)
-			  (and (eq action 'agenda) org-agenda-archives-mode))))
-	    (unless (eq action 'sparse-tree) (org-agenda-skip))
+	  (when (and
+		 ;; eval matcher only when the todo condition is OK
+		 (or (not todo-only)
+		     (and (member todo org-not-done-keywords)
+			  (let ((case-fold-search t)) (eval matcher))))
+		 ;; Call the skipper, but return t if it does not skip,
+		 ;; so that the `and' form continues evaluating
+		 (progn
+		   (unless (eq action 'sparse-tree) (org-agenda-skip))
+		   t)
+		     
+		 ;; Check if timestamps are deselecting this entry
+		 (or (not todo-only)
+		     (and (member todo org-not-done-keywords)
+			  (or (not org-agenda-tags-todo-honor-ignore-options)
+			      (not (org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item)))))
+
+		 ;; Extra check for the archive tag
+		 ;; FIXME: Does the skipper already do this????
+		 (or
+		  (not (member org-archive-tag tags-list))
+		  ;; we have an archive tag, should we use this anyway?
+		  (or (not org-agenda-skip-archived-trees)
+		      (and (eq action 'agenda) org-agenda-archives-mode))))
 
 	    ;; select this headline
 

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: Agenda todo filter order
  2011-05-08  6:03       ` Carsten Dominik
@ 2011-05-08 14:49         ` Bernt Hansen
  2011-05-08 15:55         ` Bernt Hansen
  1 sibling, 0 replies; 10+ messages in thread
From: Bernt Hansen @ 2011-05-08 14:49 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode

Carsten Dominik <carsten.dominik@gmail.com> writes:

> On 6.5.2011, at 19:40, Bernt Hansen wrote:
>
>> Hi Carsten,
>> 
>> Thanks for the patch!  This almost does what I want :)
>> 
>> This patch works for TODO agendas but not tags match agendas which is
>> what I am trying to use.
>> 
>> C-c a y returns the result I want
>> C-c a x should be identical and is not.
>
>
> Hi Bernt,
>
> here is a patch to *replace* the other patch I sent earlier.  This one
> should also work for tags-todo searches....
>
> Completely untested......
>

Thanks!  I'll try that out shortly and report back.

Regards,
Bernt

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Agenda todo filter order
  2011-05-08  6:03       ` Carsten Dominik
  2011-05-08 14:49         ` Bernt Hansen
@ 2011-05-08 15:55         ` Bernt Hansen
  2011-05-08 16:01           ` Bernt Hansen
  1 sibling, 1 reply; 10+ messages in thread
From: Bernt Hansen @ 2011-05-08 15:55 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode

Carsten Dominik <carsten.dominik@gmail.com> writes:

> On 6.5.2011, at 19:40, Bernt Hansen wrote:
>
>> Hi Carsten,
>> 
>> Thanks for the patch!  This almost does what I want :)
>> 
>> This patch works for TODO agendas but not tags match agendas which is
>> what I am trying to use.
>> 
>> C-c a y returns the result I want
>> C-c a x should be identical and is not.
>
>
> Hi Bernt,
>
> here is a patch to *replace* the other patch I sent earlier.  This one
> should also work for tags-todo searches....
>
> Completely untested......

Hi Carsten,

This patch works for me.  I'll be running with it on my master branch
until further notice.

Thanks!!

Bernt

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Agenda todo filter order
  2011-05-08 15:55         ` Bernt Hansen
@ 2011-05-08 16:01           ` Bernt Hansen
       [not found]             ` <11B052C5-6EC9-4B0A-A0FA-631908E50007@gmail.com>
  0 siblings, 1 reply; 10+ messages in thread
From: Bernt Hansen @ 2011-05-08 16:01 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode

Bernt Hansen <bernt@norang.ca> writes:

> Carsten Dominik <carsten.dominik@gmail.com> writes:
>
>> On 6.5.2011, at 19:40, Bernt Hansen wrote:
>>
>>> Hi Carsten,
>>> 
>>> Thanks for the patch!  This almost does what I want :)
>>> 
>>> This patch works for TODO agendas but not tags match agendas which is
>>> what I am trying to use.
>>> 
>>> C-c a y returns the result I want
>>> C-c a x should be identical and is not.
>>
>>
>> Hi Bernt,
>>
>> here is a patch to *replace* the other patch I sent earlier.  This one
>> should also work for tags-todo searches....
>>
>> Completely untested......
>
> Hi Carsten,
>
> This patch works for me.  I'll be running with it on my master branch
> until further notice.
>
> Thanks!!
>
> Bernt

Bah.  I spoke too soon on that.  It works great for the minimal example
I sent earlier but as soon as I applied to to my regular files my list
of REFILE tasks is broken.

   (tags "LEVEL=1+REFILE"
	 ((org-agenda-overriding-header "Notes and Tasks to Refile")
	  (org-agenda-overriding-header "Tasks to Refile")))

This now returns tasks without REFILE as a tag -- I think maybe it's
getting ALL level 1 headings.

So tag filtering is broken with this patch.

-Bernt

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Agenda todo filter order
       [not found]               ` <87liyhf459.fsf@norang.ca>
@ 2011-05-10  6:59                 ` Carsten Dominik
  2011-05-10 12:39                   ` Bernt Hansen
  0 siblings, 1 reply; 10+ messages in thread
From: Carsten Dominik @ 2011-05-10  6:59 UTC (permalink / raw)
  To: Bernt Hansen; +Cc: emacs-orgmode mailing list

I have pushed this patch.

- Carsten

On 8.5.2011, at 20:17, Bernt Hansen wrote:

> Hi Carsten,
> 
> I think this one works :)  \o/
> 
> Thanks!
> 
> -Bernt
> 
> 
> Carsten Dominik <carsten.dominik@gmail.com> writes:
> 
>> Hi Bernt,
>> 
>> here is another try, I fixed a logical bug in the previous patch...
>> Again, this patch replaces the previous one.
>> 
>> Changes at master
>> 	Modified lisp/org-agenda.el
>> diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
>> index 609edd4..84e3247 100644
>> --- a/lisp/org-agenda.el
>> +++ b/lisp/org-agenda.el
>> @@ -4575,13 +4575,12 @@ the documentation of `org-diary'."
>>       (catch :skip
>> 	(save-match-data
>> 	  (beginning-of-line)
>> +	  (org-agenda-skip)
>> 	  (setq beg (point) end (save-excursion (outline-next-heading) (point)))
>> 	  (when (org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item end)
>> 	    (goto-char (1+ beg))
>> 	    (or org-agenda-todo-list-sublevels (org-end-of-subtree 'invisible))
>> 	    (throw :skip nil)))
>> -	(goto-char beg)
>> -	(org-agenda-skip)
>> 	(goto-char (match-beginning 1))
>> 	(setq marker (org-agenda-new-marker (match-beginning 0))
>> 	      category (org-get-category)
>> 	Modified lisp/org.el
>> diff --git a/lisp/org.el b/lisp/org.el
>> index acbb261..975266c 100644
>> --- a/lisp/org.el
>> +++ b/lisp/org.el
>> @@ -12437,17 +12437,31 @@ only lines with a TODO keyword are included in the output."
>> 	    ;; selective inheritance, remove uninherited ones
>> 	    (setcdr (car tags-alist)
>> 		    (org-remove-uninherited-tags (cdar tags-alist))))
>> -	  (when (and (or (not todo-only)
>> -			 (and (member todo org-not-done-keywords)
>> -			      (or (not org-agenda-tags-todo-honor-ignore-options)
>> -				  (not (org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item)))))
>> -		     (let ((case-fold-search t)) (eval matcher))
>> -		     (or
>> -		      (not (member org-archive-tag tags-list))
>> -		      ;; we have an archive tag, should we use this anyway?
>> -		      (or (not org-agenda-skip-archived-trees)
>> -			  (and (eq action 'agenda) org-agenda-archives-mode))))
>> -	    (unless (eq action 'sparse-tree) (org-agenda-skip))
>> +	  (when (and
>> +
>> +		 ;; eval matcher only when the todo condition is OK
>> +		 (and (or (not todo-only) (member todo org-not-done-keywords))
>> +		      (let ((case-fold-search t)) (eval matcher)))
>> +
>> +		 ;; Call the skipper, but return t if it does not skip,
>> +		 ;; so that the `and' form continues evaluating
>> +		 (progn
>> +		   (unless (eq action 'sparse-tree) (org-agenda-skip))
>> +		   t)
>> +		     
>> +		 ;; Check if timestamps are deselecting this entry
>> +		 (or (not todo-only)
>> +		     (and (member todo org-not-done-keywords)
>> +			  (or (not org-agenda-tags-todo-honor-ignore-options)
>> +			      (not (org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item)))))
>> +
>> +		 ;; Extra check for the archive tag
>> +		 ;; FIXME: Does the skipper already do this????
>> +		 (or
>> +		  (not (member org-archive-tag tags-list))
>> +		  ;; we have an archive tag, should we use this anyway?
>> +		  (or (not org-agenda-skip-archived-trees)
>> +		      (and (eq action 'agenda) org-agenda-archives-mode))))
>> 
>> 	    ;; select this headline
>> 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Agenda todo filter order
  2011-05-10  6:59                 ` Carsten Dominik
@ 2011-05-10 12:39                   ` Bernt Hansen
  0 siblings, 0 replies; 10+ messages in thread
From: Bernt Hansen @ 2011-05-10 12:39 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode mailing list

Thanks!  :)

Regards,
Bernt


Carsten Dominik <carsten.dominik@gmail.com> writes:

> I have pushed this patch.
>
> - Carsten
>
> On 8.5.2011, at 20:17, Bernt Hansen wrote:
>
>> Hi Carsten,
>> 
>> I think this one works :)  \o/
>> 
>> Thanks!
>> 
>> -Bernt
>> 
>> 
>> Carsten Dominik <carsten.dominik@gmail.com> writes:
>> 
>>> Hi Bernt,
>>> 
>>> here is another try, I fixed a logical bug in the previous patch...
>>> Again, this patch replaces the previous one.
>>> 
>>> Changes at master
>>> 	Modified lisp/org-agenda.el
>>> diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
>>> index 609edd4..84e3247 100644
>>> --- a/lisp/org-agenda.el
>>> +++ b/lisp/org-agenda.el
>>> @@ -4575,13 +4575,12 @@ the documentation of `org-diary'."
>>>       (catch :skip
>>> 	(save-match-data
>>> 	  (beginning-of-line)
>>> +	  (org-agenda-skip)
>>> 	  (setq beg (point) end (save-excursion (outline-next-heading) (point)))
>>> 	  (when (org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item end)
>>> 	    (goto-char (1+ beg))
>>> 	    (or org-agenda-todo-list-sublevels (org-end-of-subtree 'invisible))
>>> 	    (throw :skip nil)))
>>> -	(goto-char beg)
>>> -	(org-agenda-skip)
>>> 	(goto-char (match-beginning 1))
>>> 	(setq marker (org-agenda-new-marker (match-beginning 0))
>>> 	      category (org-get-category)
>>> 	Modified lisp/org.el
>>> diff --git a/lisp/org.el b/lisp/org.el
>>> index acbb261..975266c 100644
>>> --- a/lisp/org.el
>>> +++ b/lisp/org.el
>>> @@ -12437,17 +12437,31 @@ only lines with a TODO keyword are included in the output."
>>> 	    ;; selective inheritance, remove uninherited ones
>>> 	    (setcdr (car tags-alist)
>>> 		    (org-remove-uninherited-tags (cdar tags-alist))))
>>> -	  (when (and (or (not todo-only)
>>> -			 (and (member todo org-not-done-keywords)
>>> -			      (or (not org-agenda-tags-todo-honor-ignore-options)
>>> -				  (not (org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item)))))
>>> -		     (let ((case-fold-search t)) (eval matcher))
>>> -		     (or
>>> -		      (not (member org-archive-tag tags-list))
>>> -		      ;; we have an archive tag, should we use this anyway?
>>> -		      (or (not org-agenda-skip-archived-trees)
>>> -			  (and (eq action 'agenda) org-agenda-archives-mode))))
>>> -	    (unless (eq action 'sparse-tree) (org-agenda-skip))
>>> +	  (when (and
>>> +
>>> +		 ;; eval matcher only when the todo condition is OK
>>> +		 (and (or (not todo-only) (member todo org-not-done-keywords))
>>> +		      (let ((case-fold-search t)) (eval matcher)))
>>> +
>>> +		 ;; Call the skipper, but return t if it does not skip,
>>> +		 ;; so that the `and' form continues evaluating
>>> +		 (progn
>>> +		   (unless (eq action 'sparse-tree) (org-agenda-skip))
>>> +		   t)
>>> +		     
>>> +		 ;; Check if timestamps are deselecting this entry
>>> +		 (or (not todo-only)
>>> +		     (and (member todo org-not-done-keywords)
>>> +			  (or (not org-agenda-tags-todo-honor-ignore-options)
>>> +			      (not (org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item)))))
>>> +
>>> +		 ;; Extra check for the archive tag
>>> +		 ;; FIXME: Does the skipper already do this????
>>> +		 (or
>>> +		  (not (member org-archive-tag tags-list))
>>> +		  ;; we have an archive tag, should we use this anyway?
>>> +		  (or (not org-agenda-skip-archived-trees)
>>> +		      (and (eq action 'agenda) org-agenda-archives-mode))))
>>> 
>>> 	    ;; select this headline
>>> 

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2011-05-10 12:39 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-20  0:33 Agenda todo filter order Bernt Hansen
2011-04-20  0:39 ` Bernt Hansen
2011-05-06  6:24   ` Carsten Dominik
2011-05-06 17:40     ` Bernt Hansen
2011-05-08  6:03       ` Carsten Dominik
2011-05-08 14:49         ` Bernt Hansen
2011-05-08 15:55         ` Bernt Hansen
2011-05-08 16:01           ` Bernt Hansen
     [not found]             ` <11B052C5-6EC9-4B0A-A0FA-631908E50007@gmail.com>
     [not found]               ` <87liyhf459.fsf@norang.ca>
2011-05-10  6:59                 ` Carsten Dominik
2011-05-10 12:39                   ` Bernt Hansen

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).