From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Abrahamsen Subject: Re: org-agenda-custom-commands clarification on filters needed Date: Mon, 29 Aug 2011 09:53:01 +0800 Message-ID: <87r5459e6a.fsf@ericabrahamsen.net> References: <20110828114011.GA26758@mail3.twallrafen.de> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([140.186.70.92]:47103) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qxr2f-00061x-Ju for emacs-orgmode@gnu.org; Sun, 28 Aug 2011 21:53:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qxr2e-00061b-GO for emacs-orgmode@gnu.org; Sun, 28 Aug 2011 21:53:37 -0400 Received: from lo.gmane.org ([80.91.229.12]:34947) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qxr2e-00061X-3w for emacs-orgmode@gnu.org; Sun, 28 Aug 2011 21:53:36 -0400 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1Qxr2d-0004ZU-16 for emacs-orgmode@gnu.org; Mon, 29 Aug 2011 03:53:35 +0200 Received: from 114.250.123.181 ([114.250.123.181]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 29 Aug 2011 03:53:35 +0200 Received: from eric by 114.250.123.181 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 29 Aug 2011 03:53:35 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org 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