emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-agenda-custom-commands clarification on filters needed
@ 2011-08-28 11:40 Thomas Wallrafen
  2011-08-29  1:53 ` Eric Abrahamsen
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Wallrafen @ 2011-08-28 11:40 UTC (permalink / raw)
  To: emacs-orgmode

Hi org'ers,

I am currently trying to figure out a way to build a composite view for
an agenda containing agenda and todos, which works well but when it
comes to setting filters...

In the first example (agenda and todo list below) the filter "+home" for
the agenda does not take effect. When reordering that the todo list is
on top and the agenda below, it works as expected. That is, both items
of the composite view are correctly filtered with tag "+home".

#+begin_src elisp
(setq org-agenda-custom-commands
	  '(("h" "Agenda and home related todos" (
		  (agenda "" ((org-agenda-filter-preset '("+home")) (org-agenda-span 4)))
		  (tags-todo "+home")
		  ))))


(setq org-agenda-custom-commands
	  '(("h" "Agenda and home related todos" (
		  (tags-todo "+home")
		  (agenda "" ((org-agenda-filter-preset '("+home")) (org-agenda-span 4)))
		  ))))

#+end_src


Having a discussion with Thumper_ on the irc channel he found out some
more oddities (copied and slightly modified by courtesy of Thumper_):

#+STARTUP:
* This one works
[2011-08-28 Sun 07:07]
#+begin_src elisp
(setq org-agenda-custom-commands
      '(("h" "Agenda and home related todos"
         ((agenda ""
                  ((org-agenda-filter-preset
                    '("+home"))
                   (org-agenda-span 4)))
          (tags-todo "+home"
                     ((org-agenda-filter-preset
                       '("+home")))))
         nil)))
#+end_src
* This also incorrectly filters the first agenda
[2011-08-28 Sun 07:07]
#+begin_src elisp
(setq org-agenda-custom-commands
      '(("h" "Agenda and home related todos"
	 ((agenda ""
		   ((org-agenda-span 4)))
	  (tags-todo "+home"
		     ((org-agenda-filter-preset
		       '("+home")))))
	 nil)))
#+end_src


So, how would I set the filters properly given that I want the agenda
tob be first and a list of todo items below?

Any pointers to documentation or hints greatly appreciated :)

bye,

thomas

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

* Re: org-agenda-custom-commands clarification on filters needed
  2011-08-28 11:40 org-agenda-custom-commands clarification on filters needed Thomas Wallrafen
@ 2011-08-29  1:53 ` Eric Abrahamsen
  2011-08-29 16:44   ` Thomas Wallrafen
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Abrahamsen @ 2011-08-29  1:53 UTC (permalink / raw)
  To: emacs-orgmode

On Sun, Aug 28 2011, Thomas Wallrafen wrote:

> Hi org'ers,
>
> I am currently trying to figure out a way to build a composite view for
> an agenda containing agenda and todos, which works well but when it
> comes to setting filters...
>
> In the first example (agenda and todo list below) the filter "+home" for
> the agenda does not take effect. When reordering that the todo list is
> on top and the agenda below, it works as expected. That is, both items
> of the composite view are correctly filtered with tag "+home".
>
> #+begin_src elisp
> (setq org-agenda-custom-commands
> 	  '(("h" "Agenda and home related todos" (
> 		  (agenda "" ((org-agenda-filter-preset '("+home")) (org-agenda-span 4)))
> 		  (tags-todo "+home")
> 		  ))))

I've been fooling with this recently, as well. The docstring for
`org-agenda-filter-preset' says that it "will not work reliably" to
filter just a single block of a multi-block custom agenda. You need to
put the filter in the tail end of the whole definition, and that way it
will apply to all the blocks (apparently there's no reliable way to
apply different filters to different blocks, but that's probably a rare
use-case). So I think you want:

(setq org-agenda-custom-commands
	  '(("h" "Agenda and home related todos"
             ((agenda)
              (tags-todo))
             ((org-agenda-filter-preset '("+home"))
              (org-agenda-span 4)))))

This or something very close to it should work. It only works with tags
though, not more complex matches.

HTH,
Eric

>
>
> (setq org-agenda-custom-commands
> 	  '(("h" "Agenda and home related todos" (
> 		  (tags-todo "+home")
> 		  (agenda "" ((org-agenda-filter-preset '("+home")) (org-agenda-span 4)))
> 		  ))))
>
> #+end_src
>
>
> Having a discussion with Thumper_ on the irc channel he found out some
> more oddities (copied and slightly modified by courtesy of Thumper_):
>
> #+STARTUP:
> * This one works
> [2011-08-28 Sun 07:07]
> #+begin_src elisp
> (setq org-agenda-custom-commands
>       '(("h" "Agenda and home related todos"
>          ((agenda ""
>                   ((org-agenda-filter-preset
>                     '("+home"))
>                    (org-agenda-span 4)))
>           (tags-todo "+home"
>                      ((org-agenda-filter-preset
>                        '("+home")))))
>          nil)))
> #+end_src
> * This also incorrectly filters the first agenda
> [2011-08-28 Sun 07:07]
> #+begin_src elisp
> (setq org-agenda-custom-commands
>       '(("h" "Agenda and home related todos"
> 	 ((agenda ""
> 		   ((org-agenda-span 4)))
> 	  (tags-todo "+home"
> 		     ((org-agenda-filter-preset
> 		       '("+home")))))
> 	 nil)))
> #+end_src
>
>
> So, how would I set the filters properly given that I want the agenda
> tob be first and a list of todo items below?
>
> Any pointers to documentation or hints greatly appreciated :)
>
> bye,
>
> thomas

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

* Re: org-agenda-custom-commands clarification on filters needed
  2011-08-29  1:53 ` Eric Abrahamsen
@ 2011-08-29 16:44   ` Thomas Wallrafen
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Wallrafen @ 2011-08-29 16:44 UTC (permalink / raw)
  To: emacs-orgmode

Hi

On Mon, Aug 29, 2011 at 09:53:01AM +0800, Eric Abrahamsen wrote:
> On Sun, Aug 28 2011, Thomas Wallrafen wrote:
> 
> > Hi org'ers,
> >
> > I am currently trying to figure out a way to build a composite view for
> > an agenda containing agenda and todos, which works well but when it
> > comes to setting filters...
> >
> > In the first example (agenda and todo list below) the filter "+home" for
> > the agenda does not take effect. When reordering that the todo list is
> > on top and the agenda below, it works as expected. That is, both items
> > of the composite view are correctly filtered with tag "+home".
> >
> > #+begin_src elisp
> > (setq org-agenda-custom-commands
> > 	  '(("h" "Agenda and home related todos" (
> > 		  (agenda "" ((org-agenda-filter-preset '("+home")) (org-agenda-span 4)))
> > 		  (tags-todo "+home")
> > 		  ))))
> 
> I've been fooling with this recently, as well. The docstring for
> `org-agenda-filter-preset' says that it "will not work reliably" to
> filter just a single block of a multi-block custom agenda. You need to
> put the filter in the tail end of the whole definition, and that way it
> will apply to all the blocks (apparently there's no reliable way to
> apply different filters to different blocks, but that's probably a rare
> use-case). So I think you want:
> 
> (setq org-agenda-custom-commands
> 	  '(("h" "Agenda and home related todos"
>              ((agenda)
>               (tags-todo))
>              ((org-agenda-filter-preset '("+home"))
>               (org-agenda-span 4)))))
> 
> This or something very close to it should work. It only works with tags
> though, not more complex matches.

Thank you for the answer. I'll experiment with that tonight.

bye,

thomas

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

end of thread, other threads:[~2011-08-29 16:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-28 11:40 org-agenda-custom-commands clarification on filters needed Thomas Wallrafen
2011-08-29  1:53 ` Eric Abrahamsen
2011-08-29 16:44   ` Thomas Wallrafen

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