From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tassilo Horn Subject: Re: Finding old appointments Date: Mon, 26 Jul 2010 13:46:44 +0200 Message-ID: <87eieqwjmj.fsf@thinkpad.tsdh.de> References: <87mxtj4612.fsf@thinkpad.tsdh.de> <876304efcg.fsf@mundaneum.com> <87wrsjig5k.fsf@thinkpad.tsdh.de> <87lj8z8iee.fsf@fastmail.fm> <87iq42wve1.fsf@thinkpad.tsdh.de> <87aapemuuk.wl%dmaus@ictsoc.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from [140.186.70.92] (port=34966 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OdM99-0001ug-12 for emacs-orgmode@gnu.org; Mon, 26 Jul 2010 07:47:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OdM93-0003UD-SL for emacs-orgmode@gnu.org; Mon, 26 Jul 2010 07:47:02 -0400 Received: from lo.gmane.org ([80.91.229.12]:48175) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OdM93-0003Tr-FG for emacs-orgmode@gnu.org; Mon, 26 Jul 2010 07:46:57 -0400 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1OdM91-0005pj-9a for emacs-orgmode@gnu.org; Mon, 26 Jul 2010 13:46:55 +0200 Received: from tsdh.uni-koblenz.de ([141.26.67.142]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 26 Jul 2010 13:46:55 +0200 Received: from tassilo by tsdh.uni-koblenz.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 26 Jul 2010 13:46:55 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org David Maus writes: Hi David, >> - headlines that contain only past timestamps and are closed TODOs (if >> they are TODOs), that is, any TODO state after the | in >> `org-todo-keywords' > >> - the same applies to all children of that entry, recursively > > This is quite simple: The function returns non-nil if an entry is > active (recursion \o/): > > (defun dmj/org-entry-is-active-p () > "Return non-nil if entry is active. > An entry is considered to be active if it has an active timestamp > in the future or an open TODO keyword or at least one active child." > (save-excursion > (beginning-of-line) > (let ((children (delq nil (org-map-entries > 'dmj/org-entry-is-active-p > (format "LEVEL>%d" (org-outline-level)) > 'tree))) > (timestamp (org-entry-get nil "TIMESTAMP"))) > (or (org-entry-is-todo-p) > children > (and timestamp (time-less-p (current-time) (org-time-string-to-time timestamp))))))) Looks good. :-) >> - the agenda should only list the top-most entries for which these >> properties hold > > This is the tougher part: Because the state of an entry > (active/inactive) depends on its children the function that finally > displays the entries must first obtain the state of the entries and > their relationships and then remove all inactive entries whose > (grand,grand...)parents are inactive. > > Sounds like you would require a a user-defined agenda function in > `org-agenda-custom-commands'. Yes, that's most likely. I'll dig into that further when I find some spare time. Thanks a lot for providing this starting point for me. Bye, Tassilo