From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alan Schmitt Subject: Re: Agenda views skip function hide parent projects Date: Wed, 05 Feb 2014 20:40:57 +0100 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:41074) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WB8LP-0008Tw-2Q for emacs-orgmode@gnu.org; Wed, 05 Feb 2014 14:41:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WB8LI-0001Wt-Rt for emacs-orgmode@gnu.org; Wed, 05 Feb 2014 14:41:11 -0500 Received: from mail3-relais-sop.national.inria.fr ([192.134.164.104]:19205) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WB8LI-0001W0-HZ for emacs-orgmode@gnu.org; Wed, 05 Feb 2014 14:41:04 -0500 In-Reply-To: (Wiskey's message of "Wed, 5 Feb 2014 12:54:15 -0500") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Wiskey 5 Alpha Cc: emacs-orgmode@gnu.org Wiskey 5 Alpha 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