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: Sun, 05 Sep 2004 14:15:23 -0500 Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Message-ID: <200409051915.i85JFNLL025425@emr.cs.iit.edu> References: <87wtzaugxd.fsf@deepthought.outer.space.org> 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 1094411751 31263 80.91.224.253 (5 Sep 2004 19:15:51 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 5 Sep 2004 19:15:51 +0000 (UTC) Cc: Emilio Lopes , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Sep 05 21:15:43 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 1C42UJ-0003bR-00 for ; Sun, 05 Sep 2004 21:15:43 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1C42ZR-0003Px-Ua for ged-emacs-devel@m.gmane.org; Sun, 05 Sep 2004 15:21:02 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1C42ZK-0003OI-8Z for emacs-devel@gnu.org; Sun, 05 Sep 2004 15:20:54 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1C42ZJ-0003NN-D7 for emacs-devel@gnu.org; Sun, 05 Sep 2004 15:20:53 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1C42ZJ-0003NF-AK for emacs-devel@gnu.org; Sun, 05 Sep 2004 15:20:53 -0400 Original-Received: from [216.47.143.101] (helo=email2.iit.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1C42U7-0002AQ-Ux for emacs-devel@gnu.org; Sun, 05 Sep 2004 15:15:32 -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 <0I3L00II71GBCZ@email2.iit.edu> for emacs-devel@gnu.org; Sun, 05 Sep 2004 14:14:35 -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 i85JFNLL025425; Sun, 05 Sep 2004 14:15:24 -0500 (CDT) In-reply-to: "Your message of Sat, 04 Sep 2004 18:39:42 +0200." <87wtzaugxd.fsf@deepthought.outer.space.org> Original-To: Detlev Zundel X-Mailer: exmh version 2.5 11/23/2002 with nmh-1.0.4 X-Attribution: EMR 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:26801 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:26801 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: (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." (interactive (let* ((today (calendar-current-date)) (year (calendar-read "ISO calendar year (>0): " '(lambda (x) (> x 0)) (int-to-string (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 1 year)))) (or noecho (calendar-print-iso-date))) And the following the appropriate places in calendar.el: (autoload 'calendar-goto-iso-week "cal-iso" "Move cursor to start of ISO WEEK in YEAR." t) (define-key calendar-mode-map "gw" 'calendar-goto-iso-week)