From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: Does secondary filtering allow multiple tags? Date: Sat, 10 Jan 2009 12:12:44 +0100 Message-ID: <7E3B0BA7-E3AD-43A4-9CDF-5CC179A3A387@uva.nl> References: <20090109015558.GQ24132@hplhtang1> <7CF6C477-A904-4B76-BA45-C0D0BCA03564@uva.nl> <20090109191823.GR24132@hplhtang1> Mime-Version: 1.0 (Apple Message framework v930.3) Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LLblr-00044O-Ly for emacs-orgmode@gnu.org; Sat, 10 Jan 2009 06:12:51 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LLblq-00042e-L8 for emacs-orgmode@gnu.org; Sat, 10 Jan 2009 06:12:50 -0500 Received: from [199.232.76.173] (port=39941 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LLblq-00042D-Ez for emacs-orgmode@gnu.org; Sat, 10 Jan 2009 06:12:50 -0500 Received: from ey-out-1920.google.com ([74.125.78.147]:32859) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LLblq-0000Cx-2r for emacs-orgmode@gnu.org; Sat, 10 Jan 2009 06:12:50 -0500 Received: by ey-out-1920.google.com with SMTP id 4so1157838eyg.24 for ; Sat, 10 Jan 2009 03:12:48 -0800 (PST) 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: Hsiu-Khuern Tang Cc: "emacs-orgmode@gnu.org" Hi Hsiu, nice hack. But I am still wondering why you do not use "primary filtering" for this, i.e. a tags search for "project1|project2" C-c a m project1|project2 RET - Carsten On Jan 9, 2009, at 8:18 PM, Hsiu-Khuern Tang wrote: > * 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. > > > _______________________________________________ > Emacs-orgmode mailing list > Remember: use `Reply All' to send replies to the list. > Emacs-orgmode@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-orgmode