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:32:28 -0800 Message-ID: <20090109193227.GS24132@hplhtang1> References: <20090109015558.GQ24132@hplhtang1> <7CF6C477-A904-4B76-BA45-C0D0BCA03564@uva.nl> <20090109191823.GR24132@hplhtang1> 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 1LLN8W-00012J-Ox for emacs-orgmode@gnu.org; Fri, 09 Jan 2009 14:35:16 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LLN8S-00011B-76 for emacs-orgmode@gnu.org; Fri, 09 Jan 2009 14:35:16 -0500 Received: from [199.232.76.173] (port=36979 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LLN8S-000116-4A for emacs-orgmode@gnu.org; Fri, 09 Jan 2009 14:35:12 -0500 Received: from gundega.hpl.hp.com ([192.6.19.190]:51261) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LLN8R-0003mV-J2 for emacs-orgmode@gnu.org; Fri, 09 Jan 2009 14:35:11 -0500 Received: from masterns.hpl.hp.com (masterns.hpl.hp.com [15.0.48.4]) by gundega.hpl.hp.com (8.14.3/8.14.1/HPL-PA Relay) with ESMTP id n09JXZeQ013527 for ; Fri, 9 Jan 2009 11:33:35 -0800 (PST) Received: from hplhtang1.hpl.hp.com (hplhtang1.hpl.hp.com [15.4.92.205]) by masterns.hpl.hp.com (8.14.3/8.14.3/HPL-PA Hub) with ESMTP id n09JWVTc030718 for ; Fri, 9 Jan 2009 11:32:32 -0800 Received: from htang by hplhtang1.hpl.hp.com with local (Exim 4.62) (envelope-from ) id 1LLN5o-00053e-D5 for emacs-orgmode@gnu.org; Fri, 09 Jan 2009 11:32:28 -0800 Content-Disposition: inline In-Reply-To: <20090109191823.GR24132@hplhtang1> 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:18PM +0000, 09 Jan 2009, Hsiu-Khuern Tang (hsiu-khuern.tang@hp.com) wrote: > 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 "\|") "}")) Correction: the above should have an extra "\": ,---- | (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)) > `---- -- Best, Hsiu-Khuern.