emacs-devel
[Top][All Lists]
Advanced

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

Re: calendar-goto-iso-week


From: Emilio Lopes
Subject: Re: calendar-goto-iso-week
Date: Sat, 04 Sep 2004 22:19:51 +0200
User-agent: Emacs Gnus

Richard Stallman writes:

>     It is somewhat unfortunate that one can't find
>     `calendar-goto-iso-date' using an apropos search with
>     "calendar.*week", but I can't suggest a better name
>     either.

> We could add an alias or trivial interface function named
> calendar-goto-week if that will be useful.

Indeed the function I wrote is just a simple wrapper around
`calendar-goto-iso-date', but I had to copy most of code
from its `interactive' declaration.

(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."
  (interactive
   (progn 
     (require 'cal-iso)
     (let* ((year (extract-calendar-year (calendar-cursor-to-date t)))
            (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-iso-date (list week calendar-week-start-day year)))




reply via email to

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