emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Filtering agenda by tags.


From: Matt Lundin
Subject: Re: [O] Filtering agenda by tags.
Date: Wed, 20 Apr 2011 08:52:32 -0400
User-agent: Gnus/5.110016 (No Gnus v0.16) Emacs/24.0.50 (gnu/linux)

Radosław Grzanka <address@hidden> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]