emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Hsiu-Khuern Tang <hsiu-khuern.tang@hp.com>
To: "emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Subject: Re: Does secondary filtering allow multiple tags?
Date: Fri, 9 Jan 2009 11:18:24 -0800	[thread overview]
Message-ID: <20090109191823.GR24132@hplhtang1> (raw)
In-Reply-To: <7CF6C477-A904-4B76-BA45-C0D0BCA03564@uva.nl>

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

  reply	other threads:[~2009-01-09 19:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-09  1:55 Does secondary filtering allow multiple tags? Hsiu-Khuern Tang
2009-01-09  7:38 ` Carsten Dominik
2009-01-09 19:18   ` Hsiu-Khuern Tang [this message]
2009-01-09 19:32     ` Hsiu-Khuern Tang
2009-01-10 11:12     ` Carsten Dominik
2009-01-12 17:37       ` Hsiu-Khuern Tang
2009-01-13  9:18         ` Carsten Dominik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090109191823.GR24132@hplhtang1 \
    --to=hsiu-khuern.tang@hp.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).