[Top][All Lists]

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


From: Emilio Lopes
Subject: calendar-goto-iso-week
Date: Sun, 29 Aug 2004 16:42:15 +0200
User-agent: Emacs Gnus

Emacs' Calendar already has `calendar-goto-iso-date', but it
requires too much user input when you just want to jump to
a given week.  The following command should help you in such

I bind it to "g w" in `calendar-mode'.

(defun calendar-goto-iso-week (week year)
  "Move cursor to ISO week number WEEK of year YEAR.
Interactively uses the \"current\" year and just asks for a week number."
     (require 'cal-iso)
     (let* ((year (extract-calendar-year (calendar-cursor-to-date t)))
            (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-iso-date (list week calendar-week-start-day year)))

reply via email to

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