Wednesday, December 22, 2010

Hack - Emacs calendar: Indian/Nepali/Hindu holidays for 2011

Ideally, it would be nice to calculate these automatically for all years (and to be able to convert from Gregorian to Vikram (Bikram) Samvat dates).... But for now, this can be inserted into your .emacs file to display Hindu holidays for 2011:

;; Hindu Holidays (North India/Nepal)
(setq holiday-other-holidays 
'(
(holiday-fixed 1 14  "Makar Sankranti")
(holiday-fixed 2 8   "Vasant Panchami / Saraswati Puja")
(holiday-fixed 3 3   "Maha Shivaratri")
(holiday-fixed 3 19  "Holi")
(holiday-fixed 4 4   "Bikrami Samvat / Hindu New Year [2068]")
(holiday-fixed 4 12  "Ram Navmi")
(holiday-fixed 4 18  "Hanuman Jayanti")
(holiday-fixed 5 6   "Akshaya Tritiya (Akha Teej)")
(holiday-fixed 6 15  "Savitri Puja")
(holiday-fixed 7 15  "Guru Purnima")
(holiday-fixed 8 4   "Naag Panchami")
(holiday-fixed 8 12  "Mahalakshmi Vrata")
(holiday-fixed 8 13  "Raksha-Bandhan + Janai Purnima")
(holiday-fixed 8 22  "Krishna Janmashtami")
(holiday-fixed 9 1   "Ganesh Chaturthi")
(holiday-fixed 9 9   "Indra Jatra begins")
(holiday-fixed 9 11  "Kumari Indra Jatra")
(holiday-fixed 9 17  "Indra Jatra ends")
(holiday-fixed 9 11  "Teej")
(holiday-fixed 9 13  "Pitr-Paksha begins")
(holiday-fixed 9 27  "Mahalaya (Pitr-Paksha ends)")
(holiday-fixed 9 28  "Navaratri begins")
(holiday-fixed 10 3  "Durga Puja begins (Maha Saptami)")
(holiday-fixed 10 5  "Navaratri ends")
(holiday-fixed 10 6  "Dasain/Dusshera (Vijaya Dashami)")
(holiday-fixed 10 11 "Lakshmi Puja (Sharad Purnima)")
(holiday-fixed 10 16 "Karwa Chauth")
(holiday-fixed 10 25 "Dhan Teras")
(holiday-fixed 10 26 "Diwali / Deepavali / Tihar")
(holiday-fixed 10 28 "Bhai Dooj")
)
)

You may want to add other holidays as appropriate, e.g. South Indian holidays; holidays specific to the Punjab, Orissa etc. The format is:
(holiday-fixed numeric-value-of-Gregorian-month numeric-day-of-month "Name-of-Holiday").

E.g. (holiday-fixed 3 5 "Losar") for the holiday Losar falling on 5th March.

2 comments :

  1. What would be cool is a way to hook up Emacs with the Hindu calendar so that it isn’t necessary to manually update the holidays.

    ReplyDelete
  2. @Aankhen. I'm working (slowly) on this. There is relevant code available (see Reingold & Dershowitz's Calendrical Calculations [http://emr.cs.uiuc.edu/~reingold/calendars.shtml] and also their paper Indian Calendrical Calculations). But it's under copyright.

    I am planning to see if it can be reworked into Emacs Lisp without violating copyright. But I'm not much of a Lisp coder, so this will take some time.

    ReplyDelete