From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: org google weather Date: Fri, 04 Mar 2011 11:38:01 -0500 Message-ID: <8736.1299256681@alphaville.dokosmarshall.org> References: <87oc5rlwc4.wl%lists@700c.org> <4D70A577.4000509@manor-farm.org> <80k4gfnth7.fsf@somewhere.org> <4D70CCB6.5080101@manor-farm.org> Reply-To: nicholas.dokos@hp.com Return-path: Received: from [140.186.70.92] (port=52475 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PvY1R-0000Qe-Cs for emacs-orgmode@gnu.org; Fri, 04 Mar 2011 11:38:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PvY1P-0003aC-NI for emacs-orgmode@gnu.org; Fri, 04 Mar 2011 11:38:33 -0500 Received: from vms173003pub.verizon.net ([206.46.173.3]:38651) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PvY1P-0003Zo-J1 for emacs-orgmode@gnu.org; Fri, 04 Mar 2011 11:38:31 -0500 Received: from alphaville.dokosmarshall.org ([unknown] [173.76.32.106]) by vms173003.mailsrvcs.net (Sun Java(tm) System Messaging Server 7u2-7.02 32bit (built Apr 16 2009)) with ESMTPA id <0LHJ005N1KVEL820@vms173003.mailsrvcs.net> for emacs-orgmode@gnu.org; Fri, 04 Mar 2011 10:38:15 -0600 (CST) In-reply-to: Message from Ian Barton of "Fri, 04 Mar 2011 11:27:50 GMT." <4D70CCB6.5080101@manor-farm.org> 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: lists@manor-farm.org Cc: nicholas.dokos@hp.com, emacs-orgmode@gnu.org Ian Barton wrote: > > > Hi Ian, > > > > Ian Barton wrote: > >>> Has anybody tried adding the functionality of %%(diary-sunrise-sunset) > >>> (sunrise, sunset time and daylight hours) to the google weather code? > >> > >> I just have something like: > >> > >> #+CATEGORY: Day/Year > >> &%%(diary-day-of-year) > >> #+CATEGORY: Sunrise > >> &%%(diary-sunrise-sunset) > >> > >> in one of my Agenda files. Sunrise then appears at sunrise time in my Agenda > >> like: > >> > >> Sunrise: 6:53...... Sunrise (GMT), sunset 5:52pm (GMT) at > >> Wilkesley (10:58 hours daylight) > > > > Do you have a way to get the sunset located on a line on its own (different > > line from the sunrise one)? That'd be even much nicer... > > > No, but I would like one:) If there were separate diary functions for > sunrise and sunset it would be easy. Maybe I need to look at the diary > elisp and write my own separate functions. > Quick hack just parsing the output of diary-sunrise-sunset. I added this early in my org-config file (which is sourced by .emacs) - modify latitude, longitude to taste: --8<---------------cut here---------------start------------->8--- ;;; diary supplement - rich in Ca (setq calendar-latitude 42.3) (setq calendar-longitude -71.0) (defun diary-sunrise () (let ((dss (diary-sunrise-sunset))) (with-temp-buffer (insert dss) (goto-char (point-min)) (search-forward ",") (buffer-substring (point-min) (match-beginning 0))))) (defun diary-sunset () (let ((dss (diary-sunrise-sunset)) start end) (with-temp-buffer (insert dss) (goto-char (point-min)) (search-forward ", ") (setq start (match-end 0)) (search-forward " at") (setq end (match-beginning 0)) (goto-char start) (capitalize-word 1) (buffer-substring start end)))) --8<---------------cut here---------------end--------------->8--- and this to one of my agenda files: --8<---------------cut here---------------start------------->8--- #+CATEGORY: Weather %%(diary-sunrise) %%(diary-sunset) --8<---------------cut here---------------end--------------->8--- and I get: ,---- | Friday 4 March 2011 | Weather: 6:16...... Sunrise (EST) | 8:00...... ---------------- | 10:00...... ---------------- | 12:00...... ---------------- | 14:00...... ---------------- | 16:00...... ---------------- | Weather: 17:36...... Sunset (EST) | 18:00...... ---------------- | 20:00...... ---------------- `---- Nick