all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Emilio Lopes <eclig@gmx.net>
Cc: Detlev Zundel <dzu@denx.de>, emacs-devel@gnu.org
Subject: Re: calendar-goto-iso-week
Date: Sat, 11 Sep 2004 11:43:17 +0200	[thread overview]
Message-ID: <jysm9pqgy2.fsf@tiscali.de> (raw)
In-Reply-To: <200409051915.i85JFNLL025425@emr.cs.iit.edu> (Ed Reingold's message of "Sun, 05 Sep 2004 14:15:23 -0500")

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)))

  reply	other threads:[~2004-09-11  9:43 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <r3hdqmqa48.fsf@tiscali.de>
     [not found] ` <87656xepjz.fsf@deepthought.outer.space.org>
     [not found]   ` <413646C5.4030607@yahoo.com>
     [not found]     ` <87656wbm9z.fsf@deepthought.outer.space.org>
2004-09-02 19:33       ` calendar-goto-iso-week Emilio Lopes
2004-09-02 23:31         ` calendar-goto-iso-week Kevin Rodgers
2004-09-04  3:29         ` calendar-goto-iso-week Richard Stallman
2004-09-04 16:39           ` calendar-goto-iso-week Detlev Zundel
2004-09-05 19:15             ` calendar-goto-iso-week Ed Reingold
2004-09-11  9:43               ` Emilio Lopes [this message]
2004-09-12  1:16                 ` calendar-goto-iso-week Ed Reingold
2004-09-12 12:38                   ` calendar-goto-iso-week Emilio Lopes
2004-09-12 20:06                     ` calendar-goto-iso-week Ed Reingold
2004-09-13 19:50                       ` calendar-goto-iso-week Emilio Lopes
2004-09-13 19:58                         ` calendar-goto-iso-week Ed Reingold
2004-09-04 20:19           ` calendar-goto-iso-week Emilio Lopes
2004-09-18 21:09 Patches to calendar Emilio Lopes
2004-09-20  0:05 ` Richard Stallman
2004-09-20 20:57   ` Emilio Lopes
2004-09-20 20:57   ` Emilio Lopes
2004-09-22  7:11     ` Richard Stallman
2004-09-22 19:25       ` Emilio Lopes
2004-09-20 22:20 ` Glenn Morris
2004-09-20 22:34   ` Miles Bader
2004-09-20 22:52     ` Glenn Morris
2004-09-20 23:05       ` Miles Bader
2004-09-21 11:35   ` Emilio C. Lopes
2004-09-21 14:10     ` Ed Reingold
2004-09-28 17:48     ` Glenn Morris

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jysm9pqgy2.fsf@tiscali.de \
    --to=eclig@gmx.net \
    --cc=dzu@denx.de \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.