* Sharing: Agenda skip function to remove future-scheduled items
@ 2014-10-14 4:43 James Harkins
2014-10-14 12:38 ` Sebastien Vauban
0 siblings, 1 reply; 4+ messages in thread
From: James Harkins @ 2014-10-14 4:43 UTC (permalink / raw)
To: emacs-orgmode
I often ask questions, or complain about things (or both at the same time), so it's nice to share something.
I was making a block agenda, splitting up tasks by location (loosely inspired by GTD). But I realized that I didn't want to see items that are scheduled for the future, because this is my agenda view for "what tasks are available right now." For example, if I have a task to update my grade sheet, it doesn't make sense to do that before I've taught the lessons -- so I don't want to see the task until it's actually due.
I didn't find a straightforward way to use a property search such as "scheduled is nil or scheduled > today," but I did (with some false starts) hack up a skip function that seems to do the job. So, in the relevant blocks, I have (org-agenda-skip-function 'hjh-skip-future-scheduled), and... perfect.
(I'm sure it's not the most efficient, but I found elisp's time comparisons to be confusing, and I didn't want to consider time-of-day either. Performance is OK for my use.)
hjh
; agenda skip function to remove items scheduled for a future date
(defun hjh-skip-future-scheduled ()
"Skip trees that are scheduled in the future"
(let* ((subtree-end (save-excursion (org-end-of-subtree t)))
(schedprop (cdr (assoc "SCHEDULED" (org-entry-properties))))
(schedymd (if(stringp schedprop) (substring schedprop 0 10))))
(if schedymd
(if (string< (format-time-string "%Y-%m-%d" (current-time)) schedymd) subtree-end nil)
nil)))
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Sharing: Agenda skip function to remove future-scheduled items
2014-10-14 4:43 Sharing: Agenda skip function to remove future-scheduled items James Harkins
@ 2014-10-14 12:38 ` Sebastien Vauban
2014-10-15 2:42 ` James Harkins
0 siblings, 1 reply; 4+ messages in thread
From: Sebastien Vauban @ 2014-10-14 12:38 UTC (permalink / raw)
To: emacs-orgmode-mXXj517/zsQ
James Harkins wrote:
> [...] I realized that I didn't want to see items that are scheduled
> for the future, because this is my agenda view for "what tasks are
> available right now." For example, if I have a task to update my grade
> sheet, it doesn't make sense to do that before I've taught the
> lessons -- so I don't want to see the task until it's actually due.
>
> I didn't find a straightforward way to use a property search such as
> "scheduled is nil or scheduled > today," but I did (with some false
> starts) hack up a skip function that seems to do the job.
I use the following (tricky) settings, which should do what you have in
mind, if I'm not mistaken:
#+begin_src emacs-lisp
;; Don't show scheduled entries in the global `todo' list.
(setq org-agenda-todo-ignore-scheduled 'future)
;; Don't show entries scheduled in the future in the global
;; `todo' list (until they are within the warning period).
(setq org-agenda-todo-ignore-deadlines 'near)
;; Honor `todo' list `org-agenda-todo-ignore...' options also
;; in the `tags-todo' list.
(setq org-agenda-tags-todo-honor-ignore-options t)
#+end_src
Best regards,
Seb
--
Sebastien Vauban
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Sharing: Agenda skip function to remove future-scheduled items
2014-10-14 12:38 ` Sebastien Vauban
@ 2014-10-15 2:42 ` James Harkins
2014-10-16 7:53 ` Sebastien Vauban
0 siblings, 1 reply; 4+ messages in thread
From: James Harkins @ 2014-10-15 2:42 UTC (permalink / raw)
To: emacs-orgmode
Sebastien Vauban <sva-news@...> writes:
> I use the following (tricky) settings, which should
do what you have in
> mind, if I'm not mistaken:
>
> #+begin_src emacs-lisp
> ;; Don't show scheduled entries in the global
`todo' list.
> (setq org-agenda-todo-ignore-scheduled 'future)
>
> ;; Don't show entries scheduled in the future in the
global
> ;; `todo' list (until they are within the warning
period).
> (setq org-agenda-todo-ignore-deadlines 'near)
>
> ;; Honor `todo' list `org-agenda-todo-ignore...'
options also
> ;; in the `tags-todo' list.
> (setq org-agenda-tags-todo-honor-ignore-options
t)
> #+end_src
Interesting. How would I apply those settings to only
one custom agenda command, while leaving the
others with the default behavior of showing future
schedules?
hjh
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Sharing: Agenda skip function to remove future-scheduled items
2014-10-15 2:42 ` James Harkins
@ 2014-10-16 7:53 ` Sebastien Vauban
0 siblings, 0 replies; 4+ messages in thread
From: Sebastien Vauban @ 2014-10-16 7:53 UTC (permalink / raw)
To: emacs-orgmode-mXXj517/zsQ
James Harkins wrote:
> Sebastien Vauban <sva-news@...> writes:
>
>> I use the following (tricky) settings, which should
> do what you have in
>> mind, if I'm not mistaken:
>>
>> #+begin_src emacs-lisp
>> ;; Don't show scheduled entries in the global `todo' list.
>> (setq org-agenda-todo-ignore-scheduled 'future)
>>
>> ;; Don't show entries scheduled in the future in the global
>> ;; `todo' list (until they are within the warning period).
>> (setq org-agenda-todo-ignore-deadlines 'near)
>>
>> ;; Honor `todo' list `org-agenda-todo-ignore...' options also
>> ;; in the `tags-todo' list.
>> (setq org-agenda-tags-todo-honor-ignore-options t)
>> #+end_src
>
> Interesting. How would I apply those settings to only
> one custom agenda command, while leaving the
> others with the default behavior of showing future
> schedules?
By setting them inside the `org-agenda-custom-commands' definition.
Best regards,
Seb
--
Sebastien Vauban
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-10-16 7:53 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-14 4:43 Sharing: Agenda skip function to remove future-scheduled items James Harkins
2014-10-14 12:38 ` Sebastien Vauban
2014-10-15 2:42 ` James Harkins
2014-10-16 7:53 ` Sebastien Vauban
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).