Another week, another Emacs extension!

I had (once again) a wonderful idea: what if I could have the weather forecasts in my Org agenda? Wouldn't that be wonderful?

My quest started by looking for a service offering a good weather forecast API. I found nothing simple as the hidden Google Weather API, which is nice, but… not documented. Not at all. Not a single line. Nah.

Then, I wrote a google-weather extension, implementing a basic Emacs Lisp API to retrieve data from the Google service:

ELISP> (google-weather-data->forecast (google-weather-get-data "Paris"))
(((9 8 2010)
(low "53")
(high "63")
(icon "http://www.google.com/ig/images/weather/rain.gif")
(condition "Rain"))
((9 9 2010)
(low "53")
(high "69")
(icon "http://www.google.com/ig/images/weather/chance_of_rain.gif")
(condition "Scattered Showers"))
((9 10 2010)
(low "54")
(high "72")
(icon "http://www.google.com/ig/images/weather/partly_cloudy.gif")
(condition "Partly Cloudy"))
((9 11 2010)
(low "55")
(high "75")
(icon "http://www.google.com/ig/images/weather/partly_cloudy.gif")
(condition "Partly Cloudy")))


My API even implements data caching, which is nice to speed up the agenda display.

By the way, I think my next job will be to hack on the url-cache feature of Emacs, which is utterly buggy and has probably never be used. But that's another topic.

Finally, I just had to write another module on top of that to export the forecasts to Org. A screen shot is probably better than a long and boring explanation, so here's the result.

Screenshot of Org agenda with weather

My only regret is that the icons provided by Google are ugly squares, so I did not want to use them. On the other hand, I did not found any icon set that would have all the icons Google provides (around 20). So I felt back on the icon naming specification to map the Google images to standard images. Any better idea would be welcome, of course.

All the information can be found on the Google Weather for Emacs extension homepage.