all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Schmitt <alan.schmitt@polytechnique.org>
To: Bastien <bzg@gnu.org>
Cc: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: Agenda view: do not display tasks of projects scheduled in the future
Date: Sun, 05 Jan 2014 11:32:46 +0100	[thread overview]
Message-ID: <m2mwjazpkh.fsf@polytechnique.org> (raw)
In-Reply-To: <8738l3zm1r.fsf@bzg.ath.cx> (Bastien's message of "Sat, 04 Jan 2014 18:36:32 +0100")

Hi Bastien,

Bastien <bzg@gnu.org> writes:

> Hi Alan,
>
> Alan Schmitt <alan.schmitt@polytechnique.org> 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

  reply	other threads:[~2014-01-05 10:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-18 14:26 Agenda view: do not display tasks of projects scheduled in the future Alan Schmitt
2014-01-04 17:36 ` Bastien
2014-01-05 10:32   ` Alan Schmitt [this message]
2014-01-05 10:44     ` Bastien

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2mwjazpkh.fsf@polytechnique.org \
    --to=alan.schmitt@polytechnique.org \
    --cc=bzg@gnu.org \
    --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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.