emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [Orgmode] complex filters in agenda view


From: Nick Dokos
Subject: Re: [Orgmode] complex filters in agenda view
Date: Sat, 26 Jun 2010 12:06:33 -0400

Matt Price <address@hidden> wrote:

> yet another question as i continue to set things up.
> 
> how would I create a custom agenda view that accomplishes this:
> (todo items marked "ACTION" OR "WAITING" AND tagged "email")? 
> I don't think I see how to do this in the manual 
> (http://orgmode.org/org.html#Custom-agenda-views).
> 
> am i missing it?  Thanks again,

Need you ask? :-) I have always thought that just as we are about to
think of something that org-mode cannot do, either we are wrong and it
is already there, or Carsten (and now et. al.) is checking in the
required change.


A bit more seriously, there was a post by Bernt Hansen recently on
exactly this question:

  http://thread.gmane.org/gmane.emacs.orgmode/26319/focus=26329

and the relevant documentation is section 10.3.3, "Matching tags and
properties", in the Org manual (particularly the last paragraph or two
in the section.)

Based on these, and on the documentation of org-agenda-custom-commands,
I came up with the following:

(setq org-agenda-custom-commands
      '(("x" "matt-price-special" tags-todo "email/!+ACTION|+WAITING")))

BTW, the ! skips DONE items and speeds up the search.

Of course, you would have to splice in the new setting to your settings
of org-agenda-custom-commands, but I assume that is clear.

That answers the question (I think), but I wanted to talk a bit more
about testing things like this: there is an old idea in emacs lisp
programming of a minimal .emacs file, where you strip everything off and
leave only what's relevant for testing. Then you fire up a bare emacs
that avoids all other complications and concentrates on *these*
complications:

     emacs -Q -l ~/minimal.emacs

Here is the minimal .emacs that I use for org (shamelessly stolen from
Bernt Hansen - you'll have to modify the paths for your setup), as modified
for your question:

,----
| ;;; constant part
| (add-to-list 'load-path (expand-file-name "~/src/emacs/org/org-mode/lisp"))
| (add-to-list 'auto-mode-alist '("\\.\\(org\\|org_archive\\|txt\\)$" . 
org-mode))
| (require 'org-install)
| (global-set-key "\C-cl" 'org-store-link)
| (global-set-key "\C-ca" 'org-agenda)
| 
| ;;; variable part
| (setq org-agenda-custom-commands
|       '(("x" "matt-price-special" tags-todo "email/!+ACTION|+WAITING")))
| 
| (setq org-agenda-files '("~/src/org/filters/matt-price.org"))
`----

and here's the file that I used for testing the custom agenda command:

,----
| #+TODO: TODO ACTION WAITING | DONE
| 
| 
| * TODO foo                                    :email:
|
| * ACTION bar
| 
| * WAITING baz
| 
| * ACTION foobar                               :email:
| 
| * DONE foobaz
| 
| * WAITING barbaz                              :email:
`----

I could then apply the custom command with C-c a x and I got the following:

,----
| Headlines with TAGS match: email/!+ACTION|+WAITING
| Press `C-u r' to search again with new search string
|   matt-price: ACTION foobar                                              
:email:
|   matt-price: WAITING barbaz                                             
:email:
`----

What I hope to do with these ramblings is to gently encourage you (and
everybody else) to provide these two things whenever you submit a
question:

       o Here is what I have in my org file.

       o Here is what I would like to see.

       o Here is what I tried.

It was fairly easy to come up with them this time, but that is not
always the case, so since you have already spent some time setting it
up, show us what you have done: you are likely to get an answer much
more quickly and it is more likely to be a correct answer that way.

Cheers,
Nick



reply via email to

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