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.

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

1
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

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?