emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Alan Schmitt <alan.schmitt@polytechnique.org>
To: Wiskey 5 Alpha <wiskey5alpha@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Agenda views skip function hide parent projects
Date: Wed, 05 Feb 2014 20:40:57 +0100	[thread overview]
Message-ID: <m2sirxibzq.fsf@polytechnique.org> (raw)
In-Reply-To: <CAE89rny1Y04L=7q_DREwLtb9nMFhsuSRdzPqwrK+4k4HsY_8qQ@mail.gmail.com> (Wiskey's message of "Wed, 5 Feb 2014 12:54:15 -0500")

Wiskey 5 Alpha <wiskey5alpha@gmail.com> writes:

> Hello all.
>
> I am sure this is documented somewhere, but I cant seem to put together
> the correct custom agenda view to support my way of project planning
>
> I have the following todo keywords defined : TODO NEXT DONE WAIT
> I like to list everything as a TODO, even if sub items may be a TODO,
> like this
>
> ** TODO Main Test Project
> *** TODO Main sub project 1
> **** NEXT first task
> *** TODO Main sub project 2 (stuck)
>
> What I would like to see is :
> on my projects list 
> TODO Main sub project 1
>
> The problem is that my project list looks like this
> TODO Main Test Project
> TODO Main sub project 1
>
> I have some projects that are 4 levels deep, so this is quite annoying.
> How do 
> I get just the "deepest" level project to show without it's parents ?

I highly recommend reading this: http://doc.norang.ca/org-mode.html

In particular, if you read this section
http://doc.norang.ca/org-mode.html#Projects you will find functions that
tell you if something is a project (i.e., is a task with a subtask).

I guess one could write something like this:

#+begin_src emacs-lisp
(defun bh/has-subproject-p ()
  "Any task with a todo keyword subtask that is a project"
  (save-restriction
    (widen)
    (let ((has-subproject)
          (subtree-end (save-excursion (org-end-of-subtree t)))
          (is-a-task (member (nth 2 (org-heading-components)) org-todo-keywords-1)))
      (save-excursion
        (forward-line 1)
        (while (and (not has-subproject)
                    (< (point) subtree-end)
                    (re-search-forward "^\*+ " subtree-end t))
          (when (bh/is-project-p)
            (setq has-subproject t))))
      (and is-a-task has-subtask))))
#end_src

then combine "is-project-p" and "has-subproject-p" to decide whether to
include something.

Alan

  reply	other threads:[~2014-02-05 19:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-05 17:54 Agenda views skip function hide parent projects Wiskey 5 Alpha
2014-02-05 19:40 ` Alan Schmitt [this message]
2014-02-05 19:50   ` Samuel Wales
2014-02-05 20:51   ` Wiskey 5 Alpha
2014-02-07 16:54 ` Wiskey 5 Alpha

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=m2sirxibzq.fsf@polytechnique.org \
    --to=alan.schmitt@polytechnique.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=wiskey5alpha@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).