emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Matthew Lundin <mdl@imapmail.org>
To: Nathaniel Flath <flat0103@gmail.com>
Cc: emacs-orgmode@gnu.org, Carsten Dominik <carsten.dominik@gmail.com>
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	[thread overview]
Message-ID: <874ohz6gwx.fsf@fastmail.fm> (raw)
In-Reply-To: <AANLkTil4TOpoQT_iwznk6goDu4eahBWslL2bf6H_4o7I@mail.gmail.com> (Nathaniel Flath's message of "Sat, 22 May 2010 10:09:36 -0400")

Nathaniel Flath <flat0103@gmail.com> 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

  reply	other threads:[~2010-05-22 16:27 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-02 17:37 [PATCH] only display a scheduled item if it is due today or in the past Nathaniel Flath
2010-05-03 14:42 ` Nathan Neff
2010-05-13  5:36 ` Carsten Dominik
2010-05-22  3:51   ` Nathaniel Flath
2010-05-22  4:50     ` Matt Lundin
2010-05-22 14:09       ` Nathaniel Flath
2010-05-22 16:27         ` Matthew Lundin [this message]
2010-05-27 16:44           ` Nathan Neff
2010-06-04 11:17         ` Carsten Dominik
2010-06-04 12:51           ` Matthew Lundin
2010-06-06  4:38             ` Carsten Dominik
2010-06-23 23:55               ` Nathan Neff
2010-06-26  7:00                 ` Livin Stephen Sharma
2010-06-28  3:18                   ` Nathan Neff

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=874ohz6gwx.fsf@fastmail.fm \
    --to=mdl@imapmail.org \
    --cc=carsten.dominik@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=flat0103@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).