[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: calendar-goto-iso-week

From: Ed Reingold
Subject: Re: calendar-goto-iso-week
Date: Sun, 05 Sep 2004 14:15:23 -0500

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."
   (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
                        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."

(define-key calendar-mode-map "gw"  'calendar-goto-iso-week)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]