From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Raymond Zeitler" Subject: Re: Sunrise / Sunset in Agenda View only for Current Day? Date: Wed, 24 Nov 2010 17:12:33 -0500 Message-ID: References: <47A80977A48444D6A6110E7CB9D85BAD@PHONON.COM> <87wrotzzno.fsf@fastmail.fm> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from [140.186.70.92] (port=60503 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PLNZu-0003sh-EY for emacs-orgmode@gnu.org; Wed, 24 Nov 2010 17:12:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PLNZt-0008MJ-8n for emacs-orgmode@gnu.org; Wed, 24 Nov 2010 17:12:38 -0500 Received: from nm6-vm0.bullet.mail.sp2.yahoo.com ([98.139.91.206]:36190) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1PLNZs-0008MC-VD for emacs-orgmode@gnu.org; Wed, 24 Nov 2010 17:12:37 -0500 In-Reply-To: <87wrotzzno.fsf@fastmail.fm> 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: 'Matt Lundin' Cc: emacs-orgmode@gnu.org This worked wonderfully! Thanks! I decided to combine the &%%(diary-day-of-year) into the same category with &%%(diary-sunrise-sunset). My setup is shown on Emacs wiki: http://www.emacswiki.org/emacs/RaymondZeitler All the best! -- Raymond Zeitler -----Original Message----- From: Matt Lundin [mailto:mdl@imapmail.org] Sent: Wednesday, November 03, 2010 8:44 PM To: Raymond Zeitler Cc: emacs-orgmode@gnu.org Subject: Re: Sunrise / Sunset in Agenda View only for Current Day? "Raymond Zeitler" writes: > I added sunrise & day of the week to the org file that I base my agenda view > on. But this adds the information for every day that's displayed in the > agenda. Is it possible to get the information to show up only for the > current day? > > TIA > > Here's the relevant content in the org file: > #+CATEGORY: Day/Year > &%%(diary-day-of-year) > #+CATEGORY: Sunrise > &%%(diary-sunrise-sunset) One way to accomplish this is with a custom skip function and a custom agenda command. In order for this particular setup to work, you'll need to put the sunrise sexp in it's own subtree, as in: --8<---------------cut here---------------start------------->8--- * Sunrise :PROPERTIES: :CATEGORY: Sunrise :END: &%%(diary-sunrise-sunset) --8<---------------cut here---------------end--------------->8--- Note: it's important that you use the CATEGORY property to ensure that the category "Sunrise" is limited to a single subtree. Then, you could add the following function to your emacs: --8<---------------cut here---------------start------------->8--- (defun my-org-skip-sunrise () (if (and (not (equal date (calendar-current-date))) (string= (org-get-category) "Sunrise")) (org-end-of-subtree t) nil)) --8<---------------cut here---------------end--------------->8--- Finally, you could define a custom command that instructs org to use the skip function to bypass all "Sunrise" entries for days other than today: --8<---------------cut here---------------start------------->8--- (add-to-list 'org-agenda-custom-commands '("x" "My agenda" agenda "" ((org-agenda-ndays 7) (org-agenda-skip-function 'my-org-skip-sunrise)))) --8<---------------cut here---------------end--------------->8--- If you're feeling brave, you could disregard the docstring for org-agenda-skip-function and bind the variable globally (i.e., invoke my-org-skip-sunrise on all agenda commands), but I wouldn't recommend this. Hope this helps, Matt