emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Custom agenda: search by tag and exclude DONE items
@ 2012-12-09 15:14 Karl Voit
  2012-12-09 21:05 ` Karl Voit
  0 siblings, 1 reply; 2+ messages in thread
From: Karl Voit @ 2012-12-09 15:14 UTC (permalink / raw)
  To: emacs-orgmode

Hi!

I want a custom agenda that lists all headings (not necessarily with
a state like TODO or NEXT) which are tagged with :borrowed: but
which are not in state DONE or CANCELED.

Should match:
* this item              :borrowed:   <- no state!
* WAITING another item   :borrowed:
* TODO some item         :borrowed:

Should *not* match:
* test item 1            :foo:
* DONE returned item     :borrowed:
* CANCELED aborted       :borrowed:

With «"cB" "borrowed" tags "+borrowed"» I do get DONE-entries as
well. 

With «"cB" "borrowed" tags-todo "..."» I do think I need any state
like TODO or NEXT which I do not want as a requirement.

Do you have an idea on how I can achieve this?

Thanks!

-- 
Karl Voit

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Custom agenda: search by tag and exclude DONE items
  2012-12-09 15:14 Custom agenda: search by tag and exclude DONE items Karl Voit
@ 2012-12-09 21:05 ` Karl Voit
  0 siblings, 0 replies; 2+ messages in thread
From: Karl Voit @ 2012-12-09 21:05 UTC (permalink / raw)
  To: emacs-orgmode

* Karl Voit <devnull@Karl-Voit.at> wrote:
> Hi!
>
> I want a custom agenda that lists all headings (not necessarily with
> a state like TODO or NEXT) which are tagged with :borrowed: but
> which are not in state DONE or CANCELED.

Following works thanks to Memnon Anon:

,----[ section within org-agenda-custom-commands ]
| ("b" "borrowed stuff" tags "+borrowed" (
|  (org-agenda-overriding-header "stuff that I borrowed")
|  (org-agenda-skip-function 'tag-without-done-or-canceled)
|  ))
`----

,----[ you function ]
| (defun tag-without-done-or-canceled ()
|   "Show items with tag \"borrowed\" that are neither in \"DONE\" or \"CANCELED \" state."
|   (let ((state (org-entry-get (point) "TODO")))
|     (if (and (member "borrowed" (org-get-tags-at (point)))
|              (not (string= state "DONE"))
|              (not (string= state "CANCELED")))
|         nil ; do not skip
|       (line-end-position)))) ; skip
`----

Thanks very much! Very handy to me!

One little thing: there are not items listed that inherit the
«borrowed» tag from any higher level heading.  But I guess this is
something that could not be done easily in this case. Right?

-- 
Karl Voit

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-12-09 21:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-09 15:14 Custom agenda: search by tag and exclude DONE items Karl Voit
2012-12-09 21:05 ` Karl Voit

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).