From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: complex filters in agenda view Date: Sat, 26 Jun 2010 12:06:33 -0400 Message-ID: <16005.1277568393@gamaville.dokosmarshall.org> References: Reply-To: nicholas.dokos@hp.com Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from [140.186.70.92] (port=52683 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OSXu6-0003E0-Ef for emacs-orgmode@gnu.org; Sat, 26 Jun 2010 12:06:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OSXu3-0005Q4-6V for emacs-orgmode@gnu.org; Sat, 26 Jun 2010 12:06:48 -0400 Received: from vms173013pub.verizon.net ([206.46.173.13]:21163) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OSXu3-0005Pv-3M for emacs-orgmode@gnu.org; Sat, 26 Jun 2010 12:06:47 -0400 Received: from gamaville.dokosmarshall.org ([unknown] [173.76.32.106]) by vms173013.mailsrvcs.net (Sun Java(tm) System Messaging Server 7u2-7.02 32bit (built Apr 16 2009)) with ESMTPA id <0L4M0098VQ2XYJ10@vms173013.mailsrvcs.net> for emacs-orgmode@gnu.org; Sat, 26 Jun 2010 11:06:34 -0500 (CDT) In-reply-to: Message from Matt Price of "Sat\, 26 Jun 2010 09\:44\:51 EDT." List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Matt Price Cc: nicholas.dokos@hp.com, emacs-orgmode@gnu.org Matt Price wrote: > yet another question as i continue to set things up. >=20 > how would I create a custom agenda view that accomplishes this: > (todo items marked "ACTION" OR "WAITING" AND tagged "email")?=C2=A0 > I don't think I see how to do this in the manual (http://orgmode.org/org.= html#Custom-agenda-views). >=20 > am i missing it?=C2=A0 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=3D26329 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) |=20 | ;;; variable part | (setq org-agenda-custom-commands | '(("x" "matt-price-special" tags-todo "email/!+ACTION|+WAITING"))) |=20 | (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 |=20 |=20 | * TODO foo :email: | | * ACTION bar |=20 | * WAITING baz |=20 | * ACTION foobar :email: |=20 | * DONE foobaz |=20 | * 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