[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Orgmode] Re: [PATCH] only display a scheduled item if it is due today o
From: |
Matthew Lundin |
Subject: |
[Orgmode] Re: [PATCH] only display a scheduled item if it is due today or in the past |
Date: |
Sat, 22 May 2010 12:27:10 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
Nathaniel Flath <address@hidden> writes:
> Yes, this patch is primarily for weekly agendas - it changes when items
> are displayed to be the same as having a style of 'habit, while also
> allowing to do it for non-recurring items.
Do you mean that it is the same as when
org-habit-show-habits-only-for-today is set to t?
> org-agenda-repeating-timestamp-show-all doesn't do quite what I want -
> I want the item to not show on my weekly agenda if it isn't scheduled
> for today, where that will make it show a maximum of once.
>
> I'd be wiling to write a personal skip function - I mainly did it this
> way because I was emulating org-habit, and then I thought it may be
> useful to other people. This is what I'll fall back to if you decide
> not to install this patch.
My main concern about the patch is that, unlike org-habit, the test is
not optional, so it adds an extra expense (however small) for everyone
who uses the agenda regardless of whether they want the test or not.
I believe this good scenario for using an org-agenda-skip-function. Does
the following skip function/custom command accomplish what you are
looking for?
--8<---------------cut here---------------start------------->8---
(defun my-org-skip-hidden-if-future ()
(let ((end-entry (save-excursion
(or (outline-next-heading) (org-end-of-subtree))))
(scheduled (org-entry-get nil "SCHEDULED"))
(hidden (when (string= (org-entry-get nil "STYLE") "hidden")
t)))
(when (and hidden scheduled)
(if (<= (- (org-time-string-to-absolute scheduled)
(calendar-absolute-from-gregorian (calendar-current-date)))
0)
nil
end-entry))))
(setq org-agenda-custom-commands
'(("x" "Weekly agenda with hidden future" agenda ""
((org-agenda-ndays 7)
(org-agenda-skip-function 'my-org-skip-hidden-if-future)
(org-agenda-start-day nil)))))
--8<---------------cut here---------------end--------------->8---
When I call it on the following subtree...
--8<---------------cut here---------------start------------->8---
* Test
** TODO Hidden and future
SCHEDULED: <2010-05-23 Sun>
:PROPERTIES:
:STYLE: hidden
:END:
** TODO Hidden and past
SCHEDULED: <2010-05-20 Thu>
:PROPERTIES:
:STYLE: hidden
:END:
** TODO Hidden and today
SCHEDULED: <2010-05-22 Sat>
:PROPERTIES:
:STYLE: hidden
:END:
--8<---------------cut here---------------end--------------->8---
...I get this agenda output...
--8<---------------cut here---------------start------------->8---
Week-agenda (W20-W21):
Saturday 22 May 2010
inbox: Sched. 3x: TODO Hidden and past
inbox: Scheduled: TODO Hidden and today
Sunday 23 May 2010
Monday 24 May 2010 W21
Tuesday 25 May 2010
Wednesday 26 May 2010
Thursday 27 May 2010
Friday 28 May 2010
--8<---------------cut here---------------end--------------->8---
HTH,
Matt