From mboxrd@z Thu Jan 1 00:00:00 1970 From: Hsiu-Khuern Tang Subject: Re: Does secondary filtering allow multiple tags? Date: Fri, 9 Jan 2009 11:18:24 -0800 Message-ID: <20090109191823.GR24132@hplhtang1> References: <20090109015558.GQ24132@hplhtang1> <7CF6C477-A904-4B76-BA45-C0D0BCA03564@uva.nl> Reply-To: Hsiu-Khuern Tang Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LLMtr-0002Eu-AD for emacs-orgmode@gnu.org; Fri, 09 Jan 2009 14:20:07 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LLMtp-0002E5-Jc for emacs-orgmode@gnu.org; Fri, 09 Jan 2009 14:20:06 -0500 Received: from [199.232.76.173] (port=56854 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LLMtp-0002E0-B9 for emacs-orgmode@gnu.org; Fri, 09 Jan 2009 14:20:05 -0500 Received: from madara.hpl.hp.com ([192.6.19.124]:61803) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LLMto-0001K3-Sl for emacs-orgmode@gnu.org; Fri, 09 Jan 2009 14:20:05 -0500 Received: from mailhub-pa1.hpl.hp.com (mailhub-pa1.hpl.hp.com [15.25.115.25]) by madara.hpl.hp.com (8.14.3/8.14.1/HPL-PA Relay) with ESMTP id n09JIRMW023552 for ; Fri, 9 Jan 2009 11:18:27 -0800 (PST) Received: from hplhtang1.hpl.hp.com (hplhtang1.hpl.hp.com [15.4.92.205]) by mailhub-pa1.hpl.hp.com (8.14.3/8.14.3/HPL-PA Hub) with ESMTP id n09JIRsb007148 for ; Fri, 9 Jan 2009 11:18:27 -0800 Received: from htang by hplhtang1.hpl.hp.com with local (Exim 4.62) (envelope-from ) id 1LLMsC-00053V-CT for emacs-orgmode@gnu.org; Fri, 09 Jan 2009 11:18:24 -0800 Content-Disposition: inline In-Reply-To: <7CF6C477-A904-4B76-BA45-C0D0BCA03564@uva.nl> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: "emacs-orgmode@gnu.org" * On Fri 07:38AM +0000, 09 Jan 2009, Carsten Dominik (dominik@science.uva.nl) wrote: > > On Jan 9, 2009, at 2:55 AM, Hsiu-Khuern Tang wrote: > > > Hi all, > > > > Suppose I have tagged some of my TODO headings. In an agenda view, > > is it > > currently possible to filter (using org-agenda-filter-by-tag) all > > entries that > > are tagged with (say) either "project1" _or_ "project2"? One can > > certainly do > > "project1" _and_ "project2" by narrowing the filter. > > No. > > - Carsten Here's a workaround. I use org-map-entries to select all headlines directly tagged with "project1" or "project2" and tag them with something unique, say "CUR". Then I can use the ordinary filter mechanism in an agenda view to restrict to headlines tagged with "CUR". ,---- | (setq cur_tags '("project1" "project2")) | | ;; Unbind the variable | ;; (makunbound 'cur_tags) | | (setq match_string (concat "+TAGS={" (mapconcat (lambda (x) x) | cur_tags "\|") "}")) | | ;; Remove the "CUR" tag: | (org-map-entries '(org-toggle-tag "CUR") "CUR" 'agenda) | | ;; Turn on the CUR tag for all headlines (directly) tagged with | ;; any member of cur_tags | (org-map-entries '(org-toggle-tag "CUR" 'on) match_string 'agenda) | | ;; Count the number of headlines (directly) tagged with any member of | ;; cur_tags: | (length (org-map-entries t match_string 'agenda)) `---- Maybe someone will find this useful, or think of a more elegant solution. -- Best, Hsiu-Khuern.