From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matthew Lundin Subject: 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 Message-ID: <874ohz6gwx.fsf@fastmail.fm> References: <87wruwfskr.fsf@fastmail.fm> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from [140.186.70.92] (port=36784 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OFrXZ-0002Z2-NG for emacs-orgmode@gnu.org; Sat, 22 May 2010 12:27:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OFrXX-0008NI-O8 for emacs-orgmode@gnu.org; Sat, 22 May 2010 12:27:09 -0400 Received: from out3.smtp.messagingengine.com ([66.111.4.27]:49623) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OFrXX-0008NA-Ki for emacs-orgmode@gnu.org; Sat, 22 May 2010 12:27:07 -0400 In-Reply-To: (Nathaniel Flath's message of "Sat, 22 May 2010 10:09:36 -0400") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Nathaniel Flath Cc: emacs-orgmode@gnu.org, Carsten Dominik Nathaniel Flath 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.=C2=A0 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=20 (or (outline-next-heading) (org-end-of-subtree)))) (scheduled (org-entry-get nil "SCHEDULED")) (hidden (when (string=3D (org-entry-get nil "STYLE") "hidden") t))) (when (and hidden scheduled) (if (<=3D (- (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