emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nick Dokos <nicholas.dokos@hp.com>
To: Matt Price <moptop99@gmail.com>
Cc: nicholas.dokos@hp.com, emacs-orgmode@gnu.org
Subject: Re: complex filters in agenda view
Date: Sat, 26 Jun 2010 12:06:33 -0400	[thread overview]
Message-ID: <16005.1277568393@gamaville.dokosmarshall.org> (raw)
In-Reply-To: Message from Matt Price <moptop99@gmail.com> of "Sat\, 26 Jun 2010 09\:44\:51 EDT." <AANLkTikPnoJ7J5t-VqJzvmYXOrt6uYRhJrBBf-_waR7V@mail.gmail.com>

Matt Price <moptop99@gmail.com> 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

      parent reply	other threads:[~2010-06-26 16:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-26 13:44 complex filters in agenda view Matt Price
2010-06-26 16:04 ` Bernt Hansen
2010-06-26 16:06 ` Nick Dokos [this message]

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=16005.1277568393@gamaville.dokosmarshall.org \
    --to=nicholas.dokos@hp.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=moptop99@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).