2

Org-mode's agenda view can display local holidays after enabling it in org-agenda-include-diary. This however displays US holidays (such as President's Day). What is the simplest way to configure it to show Canadian holidays?

Per Emacs manual,

The general holidays are, by default, holidays common throughout the United States. In contrast, holiday-local-holidays and holiday-other-holidays are both empty by default.

So, how would I use use either of those variables to replace the US holidays with Canadian holidays?

The manual further gives an example of adding a single holiday:

(setq holiday-other-holidays '((holiday-fixed 7 14 "Bastille Day")))

How would I go about adding all of the Canadian holidays? Are there no predefined lists I can use?

  • 1
    The example you provided is in the format of a list -- so just add anything else you desire: (setq holiday-other-holidays '( (holiday-fixed 7 14 "Bastille Day") (holiday-fixed 1 15 "Hello World") (holiday-fixed 6 25 "How are you today.") (holiday-fixed 11 5 "My favorite!") )) You may need some that are holiday-float depending upon when the days fall. I'm sorry, but I don't have a Canadian list already written for you to copy from. – lawlist Feb 17 '15 at 6:08
  • 1
    Here is partial list of U.S. holidays for the variable holiday-general-holidays -- you can modify everything by replacing them with Canadian holidays: (setq holiday-general-holidays '((holiday-fixed 1 1 "New Year's Day") (holiday-float 1 1 3 "Martin Luther King Day") (holiday-float 2 1 3 "President's Day") (holiday-float 5 1 -1 "Memorial Day") (holiday-fixed 6 14 "Flag Day") (holiday-fixed 7 4 "Independence Day") (holiday-float 9 1 1 "Labor Day") (holiday-float 10 1 2 "Columbus Day") (holiday-fixed 11 11 "Veteran's Day") (holiday-float 11 4 4 "Thanksgiving"))) – lawlist Feb 17 '15 at 7:16
1

You can use e.g. netherlands-holidays as a template. Afterwards, this is what I do:

(setq calendar-holidays (append calendar-holidays holiday-netherlands-holidays))
  • Thanks. Wouldn't it be cool to have an Emacs package that installs holidays list for many countries (and people can simply send a pull request to contribute additions)? – Sridhar Ratnakumar Feb 18 '15 at 7:26
  • 1
    It would be a hassle, since to maintain such a package you would need to learn a language. So we just need to find a guy that knows 200 languages. – abo-abo Feb 18 '15 at 8:13
1

I was on a similar boat. Assuming that you have your favorite calendar on google,

  • Go to google calendar and download i.e. click on "Export Calendars"
  • Unzip calendar, which should give you a .ics file
  • In your .emacs file, do the following

    (icalendar-import-file "~/wherethefileis/calendar.ics"
                   "~/diary")
    

You should comment out the above import command after your first load of .emacs file. Otherwise, every time you open your emacs, the .ics file will be imported to your diary and your diary would have multiple entries for same day.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.