From: Matt Lundin <mdl@imapmail.org>
To: Bernt Hansen <bernt@norang.ca>
Cc: emacs-orgmode@gnu.org, Carsten Dominik <carsten.dominik@gmail.com>
Subject: Re: Lazy project definitions
Date: Tue, 18 May 2010 00:18:14 -0400 [thread overview]
Message-ID: <87fx1p9721.fsf@fastmail.fm> (raw)
In-Reply-To: <87vdamnfv7.fsf@gollum.intra.norang.ca> (Bernt Hansen's message of "Mon, 17 May 2010 21:44:12 -0400")
Hi Bernt,
Bernt Hansen <bernt@norang.ca> writes:
> I've been beating my head against the wall for hours on this now. I
> tried the example from the manual and have similar results to the
> description below.
>
> Here's what I came up with as my skip function
>
> ,----
> | (defun bh/skip-non-stuck-projects ()
> | "Skip trees that are not projects"
> | (let* ((subtree-end (save-excursion (org-end-of-subtree t)))
> | (is-project (save-excursion (re-search-forward "^\\*\\{3,\\}" subtree-end t)))
> | (has-next (save-excursion (re-search-forward "^\\*\\** NEXT " subtree-end t))))
> | (if (and is-project (not has-next))
> | nil ; a stuck project, has subtasks but no next task
> | subtree-end)))
> `----
>
> and my custom agenda command is 'x' for testing
>
> ,----
> | ("x" "Stuck Projects" tags-todo "LEVEL=2-REFILE/!-DONE-CANCELLED"
> | ((org-agenda-skip-function
> | (bh/skip-non-stuck-projects)))))
> `----
>
> but this doesn't work at all like I expect. I lost a bunch of time when
> I had the 'stuck projects' selection instead of tags-todo -- it seems
> the skip function doesn't do anything useful with the stuck-projects
> setting.
>
> My returned list of tasks is still incorrect -- it contains level 2
> tasks with no children. Sometimes it throws an error -- depending on
> what buffer is displayed and where (point) is when I run C-c a x.
The custom command (and the skip function) works for me when written as
follows:
--8<---------------cut here---------------start------------->8---
(setq org-agenda-custom-commands
'(("x" "Stuck Projects" tags "LEVEL=2-REFILE/-DONE-CANCELLED"
((org-agenda-skip-function 'bh/skip-non-stuck-projects)))))
--8<---------------cut here---------------end--------------->8---
I made a couple of changes: (a) I quoted the function name and (b) I
changed tags-todo to tags and removed the exclamation point. Both
tags-todo and the exclamation point limited the results to entries with
active states, whereas (if I understand correctly) you are interested in
all level 2 headings.
When I tested the command/skip function on the following tree, only the
first 2nd level entry (** Testing) showed up in the agenda. Is this the
desired result?
--8<---------------cut here---------------start------------->8---
* Example
** Testing
*** Nothing
** Testing two
*** NEXT A todo
** Testing three
--8<---------------cut here---------------end--------------->8---
Best,
Matt
next prev parent reply other threads:[~2010-05-18 4:11 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-16 21:17 Lazy project definitions Bernt Hansen
2010-05-17 9:43 ` Carsten Dominik
2010-05-17 11:28 ` Bernt Hansen
2010-05-17 12:14 ` Bernt Hansen
2010-05-17 16:54 ` Carsten Dominik
2010-05-18 1:44 ` Bernt Hansen
2010-05-18 4:18 ` Matt Lundin [this message]
2010-05-18 11:31 ` Bernt Hansen
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=87fx1p9721.fsf@fastmail.fm \
--to=mdl@imapmail.org \
--cc=bernt@norang.ca \
--cc=carsten.dominik@gmail.com \
--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).