From: Nick Dokos <nicholas.dokos@hp.com>
To: lists@manor-farm.org
Cc: nicholas.dokos@hp.com, emacs-orgmode@gnu.org
Subject: Re: org google weather
Date: Fri, 04 Mar 2011 11:38:01 -0500 [thread overview]
Message-ID: <8736.1299256681@alphaville.dokosmarshall.org> (raw)
In-Reply-To: Message from Ian Barton <lists@manor-farm.org> of "Fri, 04 Mar 2011 11:27:50 GMT." <4D70CCB6.5080101@manor-farm.org>
Ian Barton <lists@manor-farm.org> 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
next prev parent reply other threads:[~2011-03-04 16:38 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-03 21:37 org google weather Simon Brown
2011-03-04 8:40 ` Ian Barton
2011-03-04 9:08 ` Sébastien Vauban
2011-03-04 11:27 ` Ian Barton
2011-03-04 15:29 ` brian powell
2011-03-04 16:38 ` Nick Dokos [this message]
2011-03-04 19:28 ` Bastien
2011-03-04 19:42 ` Konrad Hinsen
2011-03-04 20:26 ` Nick Dokos
2011-03-05 10:19 ` Bastien
2011-03-05 11:44 ` Matthew Sauer
2011-03-05 13:26 ` Konrad Hinsen
2011-03-05 14:57 ` Matthew Sauer
2011-03-05 15:15 ` Michael Markert
2011-03-05 15:23 ` Nick Dokos
2011-03-05 17:46 ` Matthew Sauer
2011-03-05 19:57 ` Nick Dokos
2011-03-05 14:29 ` Konrad Hinsen
2011-03-05 17:07 ` Bastien
2011-03-05 20:35 ` Konrad Hinsen
2011-03-05 21:19 ` brian powell
2011-03-05 23:51 ` Nick Dokos
2011-03-06 10:33 ` Konrad Hinsen
2011-03-06 11:20 ` Konrad Hinsen
2011-03-04 23:03 ` Sébastien Vauban
2011-03-04 23:25 ` Nick Dokos
2011-03-04 21:28 ` Simon Brown
2011-03-04 22:05 ` Nick Dokos
2011-03-04 22:29 ` Nick Dokos
2011-03-04 22:43 ` Simon Brown
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=8736.1299256681@alphaville.dokosmarshall.org \
--to=nicholas.dokos@hp.com \
--cc=emacs-orgmode@gnu.org \
--cc=lists@manor-farm.org \
/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).