[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: calendar problem: week number
From: |
Lawrence Mitchell |
Subject: |
Re: calendar problem: week number |
Date: |
Thu, 07 Aug 2008 12:40:40 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) |
Werner LEMBERG wrote:
> Companies in German are used to refer to the `Kalenderwoche' (the
> current number of the week counted from the beginning of the year).
> For example, this week is the 32nd week. Can I configure `calendar'
> to make it display, eg., like in the attached image? I haven't found
> a hint in the info file.
The following patch seems to do the right thing, although it only
works correctly if calendar-week-start-day is 1 (monday). I don't think
it breaks any of the movement commands.
Cheers,
Lawrence
diff --git a/lisp/calendar/calendar.el b/lisp/calendar/calendar.el
index dc2f8ce..9989b22 100644
--- a/lisp/calendar/calendar.el
+++ b/lisp/calendar/calendar.el
@@ -1409,7 +1409,13 @@ line."
(substring string 0 calendar-day-header-width)))
(make-string (- calendar-column-width calendar-day-header-width) ?\s)))
(calendar-ensure-newline)
- (calendar-insert-at-column indent calendar-intermonth-text trunc)
+ (calendar-insert-at-column (- indent 3) calendar-intermonth-text trunc)
+ (insert (propertize (format "%2d " (car (calendar-iso-from-absolute
+ (calendar-dayname-on-or-before
+ 1
(calendar-absolute-from-gregorian
+ (list month 1
+ year))))))
+ 'font-lock-face 'font-lock-comment-face))
;; Add blank days before the first of the month.
(insert (make-string (* blank-days calendar-column-width) ?\s))
;; Put in the days of the month.
@@ -1429,7 +1435,18 @@ line."
(/= day last))
(calendar-ensure-newline)
(setq day (1+ day)) ; first day of next week
- (calendar-insert-at-column indent calendar-intermonth-text trunc)))))
+ (calendar-insert-at-column (- indent 3) calendar-intermonth-text trunc)
+ (insert (propertize
+ (format "%2d " (car (calendar-iso-from-absolute
+ (calendar-dayname-on-or-before
+ 1
+ (calendar-absolute-from-gregorian
+ (list month
+ (+ i
+ (- 7
+ calendar-week-start-day))
+ year))))))
+ 'font-lock-face 'font-lock-comment-face))))))
(defun calendar-redraw ()
"Redraw the calendar display, if `calendar-buffer' is live."
--
Lawrence Mitchell <address@hidden>