From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Ed Reingold Newsgroups: gmane.emacs.devel Subject: Re: calendar-goto-iso-week Date: Sat, 11 Sep 2004 20:16:33 -0500 Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Message-ID: <200409120116.i8C1GXGJ019257@emr.cs.iit.edu> References: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7BIT X-Trace: sea.gmane.org 1094951852 15102 80.91.229.6 (12 Sep 2004 01:17:32 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 12 Sep 2004 01:17:32 +0000 (UTC) Cc: Detlev Zundel , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Sep 12 03:17:18 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1C6IzW-0002dM-00 for ; Sun, 12 Sep 2004 03:17:18 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1C6J4x-0005gV-Rz for ged-emacs-devel@m.gmane.org; Sat, 11 Sep 2004 21:22:55 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1C6J4s-0005gO-3g for emacs-devel@gnu.org; Sat, 11 Sep 2004 21:22:50 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1C6J4p-0005fZ-7l for emacs-devel@gnu.org; Sat, 11 Sep 2004 21:22:49 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1C6J4p-0005fW-3c for emacs-devel@gnu.org; Sat, 11 Sep 2004 21:22:47 -0400 Original-Received: from [216.47.143.101] (helo=email2.iit.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1C6Iz2-0006XL-A0 for emacs-devel@gnu.org; Sat, 11 Sep 2004 21:16:48 -0400 Original-Received: from emr.cs.iit.edu (emr.cs.iit.edu [216.47.142.126]) by email2.iit.edu (iPlanet Messaging Server 5.2 HotFix 1.21 (built Sep 8 2003)) with ESMTP id <0I3W00K0HM66A2@email2.iit.edu> for emacs-devel@gnu.org; Sat, 11 Sep 2004 20:15:42 -0500 (CDT) Original-Received: from emr.cs.iit.edu (localhost [127.0.0.1]) by emr.cs.iit.edu (8.12.10+Sun/8.12.2) with ESMTP id i8C1GXGJ019257; Sat, 11 Sep 2004 20:16:33 -0500 (CDT) In-reply-to: Message from Emilio Lopes "of Sat, 11 Sep 2004 11:43:17 +0200." Original-To: eclig@gmx.net X-Mailer: exmh version 2.5 11/23/2002 with nmh-1.0.4 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: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:27032 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:27032 > > I would add the following to cal-iso.el; this requires the > > user to hit return after the year, but allows movement > > more generally to other years: > > It's my experience that one more often wants to move to a > week in the current year. So I changed your code to only > ask for YEAR when called with a prefix argument. What do > you think? I prefer what I had because it is consistent with the other "go-to" date functions. > Also note the use of calendar-week-start-day bellow. I did not use that because on the ISO calendar it is Monday that is the first day of the week,; what is displayed is irrelevant--it is a matter of the ISO definition! > > > (defun calendar-goto-iso-week (week year &optional noecho) > "Move cursor to start of ISO WEEK in YEAR; echo ISO date unless NOECHO is t. > Interactively asks for YEAR only when called with a prefix argument." > (interactive > (let* ((today (calendar-current-date)) > (year (if current-prefix-arg > (calendar-read > "ISO calendar year (>0): " > '(lambda (x) (> x 0)) > (int-to-string (extract-calendar-year today))) > (extract-calendar-year today))) > (no-weeks (extract-calendar-month > (calendar-iso-from-absolute > (1- > (calendar-dayname-on-or-before > 1 (calendar-absolute-from-gregorian > (list 1 4 (1+ year)))))))) > (week (calendar-read > (format "ISO calendar week (1-%d): " no-weeks) > '(lambda (x) (and (> x 0) (<= x no-weeks)))))) > (list week year))) > (calendar-goto-date (calendar-gregorian-from-absolute > (calendar-absolute-from-iso > (list week calendar-week-start-day year)))) > (or noecho (calendar-print-iso-date))) > > > > _______________________________________________ > Emacs-devel mailing list > Emacs-devel@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-devel