1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Emacsのcalendarで日本の祝日を表示する

Last updated at Posted at 2013-06-21

GNU emacsのcalendarは様々な祝日が登録されていて面白いが、実際に表示させると祝日だらけでわかり辛い。

2013.3.20: Vernal Equinox 20:01 (JST)
2013.3.21: Bahá'í New Year (Naw-Ruz) 170
2013.4.21: First Day of Ridvan
2013.4.29: Ninth Day of Ridvan
2013.4.29: 昭和の日
2013.5.2: Twelfth Day of Ridvan
2013.5.3: 憲法記念日
2013.5.4: 国民の休日
2013.5.5: こどもの日
2013.5.23: Declaration of the Báb
2013.5.29: Ascension of Bahá'u'lláh

そこで、日本の祝日をholiday-local-holidaysに登録し、それだけを表示させるようにした。

.emacs.d/init.el
(require 'solar)
(setq holiday-general-holidays nil
      holiday-local-holidays t
      holiday-solar-holidays nil
      holiday-bahai-holidays nil
      holiday-christian-holidays nil
      holiday-hebrew-holidays nil
      holiday-islamic-holidays nil
      holiday-oriental-holidays nil
      holiday-other-holidays nil
      mark-holidays-in-calendar t)
(setq holiday-local-holidays
      '((holiday-fixed 1 1 "元日")
	(holiday-float 1 1 2 "成人の日")
	(holiday-fixed 2 11 "建国記念の日")
	(holiday-sexp '(map 'list 'truncate (solar-equinoxes/solstices 0 year)) "春分の日")
	(holiday-fixed 4 29 "昭和の日")
	(holiday-fixed 5 3 "憲法記念日")
	(holiday-fixed 5 4 "みどりの日")
 	(holiday-fixed 5 5 "こどもの日")
	(holiday-float 7 1 3 "海の日")
	(holiday-float 7 1 3 "敬老の日")
	(holiday-sexp '(map 'list 'truncate (solar-equinoxes/solstices 2 year)) "秋分の日")
	(holiday-float 10 1 2 "体育の日")
	(holiday-fixed 11 3 "文化の日")
	(holiday-fixed 11 23 "勤労感謝の日")
	(holiday-fixed 12 23 "天皇誕生日")
))

2013年6月現在の国民の祝日に関する法律に準拠している。
春分と秋分の計算にsolar.elを使用している。なお、春分の日と秋分の日は、国立天文台「暦象年表」に基づき閣議決定され、前年2月1日頃に官報で暦要項として公告されるものなので(wikipedia)、この計算と違う日になる可能性がある。
振替休日はÀ faireということで。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?