emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Matt Lundin <lundin@fastmail.fm>
To: radoslawg@gmail.com
Cc: Org-mode ml <emacs-orgmode@gnu.org>
Subject: Re: Filtering agenda by tags.
Date: Wed, 20 Apr 2011 08:52:32 -0400	[thread overview]
Message-ID: <87bp01axv3.fsf@fastmail.fm> (raw)
In-Reply-To: <4DAEB2CE.2040708@gmail.com> ("Radosław Grzanka"'s message of "Wed, 20 Apr 2011 12:17:50 +0200")

Radosław Grzanka <radoslawg@gmail.com> writes:

> Hello,
>   I have another problem which I fail on resolving.
>
> Let's say I have a org file
>
> --------------
> #+FILETAGS: work
>
> * Do something at work
> * Do something at the internet    :internet:
> --------------
>
> and another file:
>
> --------------
>
> * Do something at home            :home:
> * Do something at the internet    :internet:
> * Some other untagged task
>
> --------------
>
> I'd like to have two agenda views:
>
> 1. should show things I can do at work and internet and untagged tasks
> 2. should show things I can do at home and internet and untagged tasks
>

(setq org-agenda-custom-commands
      '(("x" "Work and internet and untagged" tags "+work|+internet|-TAGS={.}")
	("X" "Home and internet and untagged" tags "+home|+interent|-TAGS={.}")))

I am assuming that when you say "untagged", you mean items without local
tags. If you want inherited tags to be considered, use ALLTAGS instead.

> I fail with defining custom agenda views. I've browsed google and
> already tried:
> - org-agenda-filter-preset - but that seems not to support "or" (maybe
> I'm missing something?)
> - org-agenda-skip-function - which I found googling around - with
> regexp like '(org-agenda-skip-subtree-if 'regexp ":work:")' - but that
> seems not to support "inherited" tags.

The simplest solution is just to use a query/match (as above). The
variables org-agenda-filter-preset and org-agenda-skip-function are
meant primarily for agenda views, which are built around timestamps
rather than tags searches. When simply searching for tags, the tags
matcher is the best bet.

Note, you could accomplish the same thing with:

C-c a m "work|internet|-TAGS={.}"

See the following for more information:

- (info "(org) Tag searches")
- (info "(org) Matching tags and properties")
- http://orgmode.org/worg/org-tutorials/advanced-searching.html#tag-searches
- http://orgmode.org/worg/org-tutorials/org-custom-agenda-commands.html

Best,
Matt

  reply	other threads:[~2011-04-20 12:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-20 10:17 Filtering agenda by tags Radosław Grzanka
2011-04-20 12:52 ` Matt Lundin [this message]
2011-04-20 13:05   ` Radosław Grzanka
2011-04-20 13:12     ` Matt Lundin
2011-04-20 13:16       ` Radosław Grzanka
2011-04-20 14:02         ` Matt Lundin
2011-04-30 15:48           ` Mike McLean

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=87bp01axv3.fsf@fastmail.fm \
    --to=lundin@fastmail.fm \
    --cc=emacs-orgmode@gnu.org \
    --cc=radoslawg@gmail.com \
    /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).