From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Emilio Lopes Newsgroups: gmane.emacs.devel Subject: Re: calendar-goto-iso-week Date: Sat, 11 Sep 2004 11:43:17 +0200 Organization: private Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Message-ID: References: <200409051915.i85JFNLL025425@emr.cs.iit.edu> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1094895749 357 80.91.224.253 (11 Sep 2004 09:42:29 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 11 Sep 2004 09:42:29 +0000 (UTC) Cc: Detlev Zundel , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Sep 11 11:42:21 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 1C64Oi-0001Hi-00 for ; Sat, 11 Sep 2004 11:42:21 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1C64U8-0003rL-IS for ged-emacs-devel@m.gmane.org; Sat, 11 Sep 2004 05:47:56 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1C64T9-0003YL-2r for emacs-devel@gnu.org; Sat, 11 Sep 2004 05:46:55 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1C64T5-0003XB-Ri for emacs-devel@gnu.org; Sat, 11 Sep 2004 05:46:53 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1C64T5-0003Wy-GI for emacs-devel@gnu.org; Sat, 11 Sep 2004 05:46:51 -0400 Original-Received: from [62.26.116.129] (helo=webmail.tiscali.de) by monty-python.gnu.org with esmtp (Exim 4.34) id 1C64NR-0001XA-OF for emacs-devel@gnu.org; Sat, 11 Sep 2004 05:41:02 -0400 Original-Received: from jumeira.tiscali.de (62.246.24.235) by webmail.tiscali.de (6.7.019) id 40FB8991012885E2; Sat, 11 Sep 2004 11:40:40 +0200 Original-To: Ed Reingold Mail-Followup-To: eclig@gmx.net In-Reply-To: <200409051915.i85JFNLL025425@emr.cs.iit.edu> (Ed Reingold's message of "Sun, 05 Sep 2004 14:15:23 -0500") User-Agent: Emacs Gnus 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:27000 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:27000 Ed Reingold writes: > 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? Also note the use of calendar-week-start-day bellow. (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)))