emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Bastien <bzg@altern.org>
To: emacs-orgmode@gnu.org
Subject: Re: Custom agenda views
Date: Sun, 28 Oct 2007 10:46:33 +0000	[thread overview]
Message-ID: <87640ttz1q.fsf@bzg.ath.cx> (raw)
In-Reply-To: <A114961D625BD64F9DC27B34B6225AA2033F3E9C@memoir.skokie.lib.il.us> (Dave C. Nelson's message of "Fri, 26 Oct 2007 09:20:11 -0500")

"Dave C. Nelson" <DCNelson@skokielibrary.info> writes:

> What I want is to have an agenda view like the default agenda view one
> gets with c-a a, but "narrowed" so that only a subset of todo items
> show. For example, when I'm at work, I want to narrow the agenda view
> so that it only shows todo items related to work.

What about using agenda blocks[1]?

(org-add-agenda-custom-command
      '("v" "Agenda and Work-related tasks"
	((tags-todo "WORK")
         (agenda))))

If you just want to use the agenda block and select entries in it, you
can do this with `org-agenda-skip-function'[2]:

(org-add-agenda-custom-command
      '("v" agenda "PROJECT"
        ((org-agenda-skip-function 'my-skip-unless-work)
         (org-agenda-overriding-header "Projects related to work: "))))

(defun my-skip-unless-work ()
       "Skip trees that are not tagged as :WORK:"
       (let ((subtree-end (save-excursion (org-end-of-subtree t))))
         (if (re-search-forward ":WORK:" subtree-end t)
             nil          ; tag found, do not skip
           subtree-end))) ; tag not found, continue after end of subtree

HTH,

Notes: 
[1]  See (info "(org)Block agenda")
[2]  See (info "(org)Special agenda views")

-- 
Bastien

      parent reply	other threads:[~2007-10-28  9:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-26 14:20 Custom agenda views Dave C. Nelson
2007-10-26 14:36 ` Bernt Hansen
2007-10-26 15:10   ` Wanrong Lin
2007-10-26 15:20   ` Dave C. Nelson
2007-10-26 15:56     ` Bernt Hansen
2007-10-28 11:03       ` Bastien
2007-10-28 10:46 ` Bastien [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=87640ttz1q.fsf@bzg.ath.cx \
    --to=bzg@altern.org \
    --cc=emacs-orgmode@gnu.org \
    /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).