From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alan Schmitt Subject: Re: Agenda view: do not display tasks of projects scheduled in the future Date: Sun, 05 Jan 2014 11:32:46 +0100 Message-ID: References: <8738l3zm1r.fsf@bzg.ath.cx> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:54073) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vzl1J-0006q3-8F for emacs-orgmode@gnu.org; Sun, 05 Jan 2014 05:33:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vzl1A-0007mj-RE for emacs-orgmode@gnu.org; Sun, 05 Jan 2014 05:33:25 -0500 In-Reply-To: <8738l3zm1r.fsf@bzg.ath.cx> (Bastien's message of "Sat, 04 Jan 2014 18:36:32 +0100") 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: Bastien Cc: emacs-orgmode Hi Bastien, Bastien writes: > Hi Alan, > > Alan Schmitt writes: > >> #+BEGIN_SRC emacs-lisp >> (defun as/skip-future-tasks () >> "Skip future tasks" >> (save-restriction >> (widen) >> (let ((subtree-end (save-excursion (org-end-of-subtree t)))) >> (cond >> ((org-entry-scheduded-in-future-p) >> subtree-end) >> (t >> nil))))) >> #+END_SRC >> >> Any suggestion as how I might write such a predicate? > > Coming late so maybe it's not useful anymore, but here is a stab: > > (defun org-entry-scheduded-in-future-p () > (interactive) > (let ((sc (org-get-scheduled-time (point))) > ;; (dl (org-get-deadline-time (point))) > ;; (ts (org-time-string-to-time (org-entry-get (point) "TIMESTAMP"))) > (ct (current-time))) > (time-less-p ct sc))) This was most helpful, thank you. This is what I finally came up with (I just added a check that there was a scheduled time): (defun org-entry-scheduled-in-future-p () (interactive) (let ((sc (org-get-scheduled-time (point))) ;; (dl (org-get-deadline-time (point))) ;; (ts (org-time-string-to-time (org-entry-get (point) "TIMESTAMP"))) (ct (current-time))) (and sc (time-less-p ct sc)))) By the way, is there a place where the functions such as "org-get-scheduled-time" are documented? Or does one have to look at the source? Thanks again, Alan