Hi Bastien,

Bastien <b...@gnu.org> writes:

> Hi Alan,
>
> Alan Schmitt <alan.schm...@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 via email to