From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ed Reingold Newsgroups: gmane.emacs.devel Subject: Re: calendar problem: week number Date: Thu, 07 Aug 2008 06:58:54 -0500 Message-ID: <200808071159.m77Bwscv002742@emr.cs.iit.edu> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1218110369 23070 80.91.229.12 (7 Aug 2008 11:59:29 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 7 Aug 2008 11:59:29 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Aug 07 14:00:20 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KR4AF-0005q0-MU for ged-emacs-devel@m.gmane.org; Thu, 07 Aug 2008 14:00:20 +0200 Original-Received: from localhost ([127.0.0.1]:47547 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KR49K-0000cC-Ah for ged-emacs-devel@m.gmane.org; Thu, 07 Aug 2008 07:59:22 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KR49D-0000c7-P3 for emacs-devel@gnu.org; Thu, 07 Aug 2008 07:59:15 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KR49B-0000bv-TV for emacs-devel@gnu.org; Thu, 07 Aug 2008 07:59:14 -0400 Original-Received: from [199.232.76.173] (port=41555 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KR49B-0000bs-LS for emacs-devel@gnu.org; Thu, 07 Aug 2008 07:59:13 -0400 Original-Received: from emr.cs.iit.edu ([216.47.142.126]:49023) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KR49A-0005oI-Tb for emacs-devel@gnu.org; Thu, 07 Aug 2008 07:59:13 -0400 Original-Received: from emr.cs.iit.edu (localhost [127.0.0.1]) by emr.cs.iit.edu (8.13.8+Sun/8.13.8) with ESMTP id m77Bwscv002742 for ; Thu, 7 Aug 2008 06:59:07 -0500 (CDT) X-Mailer: exmh version 2.7.2 01/07/2005 with nmh-1.0.4 In-Reply-To: Message from Lawrence Mitchell of "Thu, 07 Aug 2008 12:40:40 BST." X-detected-kernel: by monty-python.gnu.org: Solaris 9 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:102157 Archived-At: The "fix" below will break many, many things--holidays, diary entries, conversions to other calendars, etc. The exact shape of the calendar window cannot be changed. > 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 > >