LoginSignup
1
1

More than 5 years have passed since last update.

CalendarでISO週番号を正しく表示

Last updated at Posted at 2016-01-17

ビルドインの calendar.el にある calendar-intermonth-text をカスタマイズすると,カレンダーに週番号を表示させることが可能.ただ, calendar.el に記載されている例だと, calendar-week-start-day1 以外の時に計算結果がおかしくなる.
次のように calendar-absolute-from-gregorian に渡す値を補正するとうまくいく.

(setq calendar-intermonth-text
        '(propertize
          (format "%02d"
                  (car
                   (calendar-iso-from-absolute
                    (calendar-absolute-from-gregorian
                     (list month (- day (1- calendar-week-start-day)) year)))))
          'font-lock-face 'calendar-iso-week-face))

see also
- http://www.emacswiki.org/emacs/CalendarWeekNumbers
- http://stackoverflow.com/questions/21364948/how-to-align-the-calendar-with-week-number-as-the-intermonth-text
- https://blogs.msdn.microsoft.com/shawnste/2006/01/24/iso-8601-week-of-year-format-in-microsoft-net/
- https://discussions.apple.com/thread/7179260?start=0&tstart=0
- http://www.h3.dion.ne.jp/~sakatsu/Excel_Tips20.htm

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