3

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 06: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 07:16
  • https://www.emacswiki.org/emacs/CalendarLocalization – Günter Zöchbauer May 21 '20 at 17:24

3 Answers3

1

To add more than one single date, my approach is to add in your configuration file the following code (this example is for Madrid, Spain, so change the example to your needs):

(setq holiday-other-holidays
    '((holiday-fixed 1 1 "Año Nuevo")
      (holiday-fixed 1 6 "Día de Reyes")
      (holiday-fixed 3 19 "San José")
      (holiday-fixed 5 1 "Fiesta del Trabajo")
      (holiday-fixed 5 2 "Fiesta de la Comunidad de Madrid")
      (holiday-fixed 5 15 "Fiesta de San Isidro")
      (holiday-fixed 10 12 "Día de la Hispanidad")
      (holiday-fixed 11 1 "Día de Todos los Santos")
      (holiday-fixed 12 6 "Día de la Constitución")
      (holiday-fixed 12 8 "Día de la Inmaculada")))

For every local holiday include a line as per the following example:

(holiday-fixed month-number day-number "Name of the local event")
jdelacueva
  • 11
  • 4
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))
abo-abo
  • 13,943
  • 1
  • 29
  • 43
  • 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 07: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 08: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.

jimmu
  • 385
  • 2
  • 8