2010-06-10

worldcup games in your org-mode agenda

A significant part of the world population will be watching the Football World Cup in South-Africa this month. For people who use org-mode to organize their lives, find the schedule of all the games in this message I sent to the org-mode mailing list.

In order to have the games show up in your agenda, make sure the file is in your org-agenda-files. If needed, you could add it with something like in your org-mode settings:

(add-to-list 'org-agenda-files "~/org/fifa-worldcup-2010.org")

One small issue with the schedule is that it use the South-African times, and there is no automatic way to adjust times for the local time zone. As a work-around, Juan Pechiar provided the following function which makes it easy to update all org-timestamps in a file:

(defun uphours (n)
  "update all timestamps n hours"
  (interactive "nAdd hours: ")
  (save-excursion
    (goto-char (point-min))
    (while (re-search-forward "[[<]" nil t)
      (when (org-at-timestamp-p t)
        (org-timestamp-change n 'hour)
        ))))

Evaluate this function (in emacs, put your cursor after the last ")"), then press C-x C-e. After that, you can go to the file with the world cup schedule, and give an M-x uphours, provide the offset for your timezone, compare to South-African time (positive or negative).

4 comments:

Anonymous said...

howto get the results of the games into the agenda, so that orgmode can compute the games after the group competition?

djcb said...

@Anonymous: I suppose it's possible, you could put the games in a table and use 'calc' etc.; left as an exercise for the reader. Bonus points if you can already calculate the games before they are played :-)

Ermintrude said...

Wow! I never expected this for your 102nd post :-)
Marvellous blog!

amos said...

That's fantastic.