all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Agenda view: do not display tasks of projects scheduled in the future
@ 2013-12-18 14:26 Alan Schmitt
  2014-01-04 17:36 ` Bastien
  0 siblings, 1 reply; 4+ messages in thread
From: Alan Schmitt @ 2013-12-18 14:26 UTC (permalink / raw)
  To: emacs-orgmode

Hello,

I would like to tweak my agenda views such that tasks belonging to
projects scheduled in the future are not shown. I've searched a bit
about this and I found out that deadlines and schedules are not
inherited, so that approach would not work. I'm thus trying to tweak a
custom skip function to jump over any headline scheduled for the future.

I looked into org.el but could not find a way to write a predicate
"org-entry-scheduled-in-future-p" that is true when an entry is
scheduled in the future. I would use it for the following skipping
command:

#+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?

Thanks,

Alan

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Agenda view: do not display tasks of projects scheduled in the future
  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
  0 siblings, 1 reply; 4+ messages in thread
From: Bastien @ 2014-01-04 17:36 UTC (permalink / raw)
  To: Alan Schmitt; +Cc: emacs-orgmode

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)))

-- 
 Bastien

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Agenda view: do not display tasks of projects scheduled in the future
  2014-01-04 17:36 ` Bastien
@ 2014-01-05 10:32   ` Alan Schmitt
  2014-01-05 10:44     ` Bastien
  0 siblings, 1 reply; 4+ messages in thread
From: Alan Schmitt @ 2014-01-05 10:32 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Agenda view: do not display tasks of projects scheduled in the future
  2014-01-05 10:32   ` Alan Schmitt
@ 2014-01-05 10:44     ` Bastien
  0 siblings, 0 replies; 4+ messages in thread
From: Bastien @ 2014-01-05 10:44 UTC (permalink / raw)
  To: Alan Schmitt; +Cc: emacs-orgmode

Hi Alan,

Alan Schmitt <alan.schmitt@polytechnique.org> writes:

> 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?

Commands (i.e. interactive functions) are documented here:
http://orgmode.org/worg/doc.html#commands

but for functions you'll have to look at the source, yes.

-- 
 Bastien

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-01-05 10:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2014-01-05 10:44     ` Bastien

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.