* Re: calendar-goto-iso-week
[not found] ` <87656wbm9z.fsf@deepthought.outer.space.org>
@ 2004-09-02 19:33 ` Emilio Lopes
2004-09-02 23:31 ` calendar-goto-iso-week Kevin Rodgers
2004-09-04 3:29 ` calendar-goto-iso-week Richard Stallman
0 siblings, 2 replies; 25+ messages in thread
From: Emilio Lopes @ 2004-09-02 19:33 UTC (permalink / raw)
Cc: emacs-devel
[Mailed and posted]
Detlev Zundel writes:
>> > This is incredibly useful. Could you please post this
>> > on emacs.devel so it could get included in the main
>> > calendar.el?
Thanks. I'm CCing this to emacs-devel too.
> However I repeatedly have to check the date for a calendar
> week while being on the phone and then I want to type (and
> visually parse) as few as possible so I still think the
> separate function has value on its own.
Yes, that was my motivation too. It's very common in Germany
to refer to calendar weeks when making appointments or
talking about deadlines.
> And to be honest, I didn't even realize I was able to
> achieve this goal with 'calendar-goto-iso-date' as I was
> never able to deduce this from the function name without
> checking the actual code.
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.
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: calendar-goto-iso-week
2004-09-02 19:33 ` calendar-goto-iso-week Emilio Lopes
@ 2004-09-02 23:31 ` Kevin Rodgers
2004-09-04 3:29 ` calendar-goto-iso-week Richard Stallman
1 sibling, 0 replies; 25+ messages in thread
From: Kevin Rodgers @ 2004-09-02 23:31 UTC (permalink / raw)
Emilio Lopes wrote:
> Detlev Zundel writes:
>>However I repeatedly have to check the date for a calendar
>>week while being on the phone and then I want to type (and
>>visually parse) as few as possible so I still think the
>>separate function has value on its own.
>
> Yes, that was my motivation too. It's very common in Germany
> to refer to calendar weeks when making appointments or
> talking about deadlines.
They are talking about this message:
From: Emilio Lopes <eclig@gmx.net>
Newsgroups: gnu.emacs.sources
Subject: calendar-goto-iso-week
Date: Sun, 29 Aug 2004 16:42:15 +0200
Message-ID: <r3hdqmqa48.fsf@tiscali.de>
But I think a better solution is simply to provide a default day when
calendar-goto-iso-date reads the date, just like it already provides a
default year:
From: Kevin Rodgers <ihs_4664@yahoo.com>
Newsgroups: gnu.emacs.sources
Subject: Re: calendar-goto-iso-week
Date: Wed, 01 Sep 2004 16:01:41 -0600
Message-ID: <413646C5.4030607@yahoo.com>
>>And to be honest, I didn't even realize I was able to
>>achieve this goal with 'calendar-goto-iso-date' as I was
>>never able to deduce this from the function name without
>>checking the actual code.
>
> 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.
(defalias 'calendar-goto-iso-week-start 'calendar-goto-iso-date)
--
Kevin Rodgers
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: calendar-goto-iso-week
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 ` Richard Stallman
2004-09-04 16:39 ` calendar-goto-iso-week Detlev Zundel
2004-09-04 20:19 ` calendar-goto-iso-week Emilio Lopes
1 sibling, 2 replies; 25+ messages in thread
From: Richard Stallman @ 2004-09-04 3:29 UTC (permalink / raw)
Cc: Glenn Morris, emacs-devel
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.
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: calendar-goto-iso-week
2004-09-04 3:29 ` calendar-goto-iso-week Richard Stallman
@ 2004-09-04 16:39 ` Detlev Zundel
2004-09-05 19:15 ` calendar-goto-iso-week Ed Reingold
2004-09-04 20:19 ` calendar-goto-iso-week Emilio Lopes
1 sibling, 1 reply; 25+ messages in thread
From: Detlev Zundel @ 2004-09-04 16:39 UTC (permalink / raw)
Richard Stallman <rms@gnu.org> wrote:
> 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.
As I argued, an alias would be nice to at least find the functionality
but I still like a function that prompts me for only the week as I
want to use it while being in the middle of a conversation. So I vote
for the "trivial interface function" suggested by Emilio Lopes
<eclig@gmx.net> and bind it e.g. 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."
(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)))
This works fine for me.
Thanks
Detlev
--
Each language has its purpose, however humble. Each language expresses
the Yin and Yang of software. Each language has its place within the Tao.
But do not program in COBOL if you can avoid it.
-- The Tao of Programming
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: calendar-goto-iso-week
2004-09-04 3:29 ` calendar-goto-iso-week Richard Stallman
2004-09-04 16:39 ` calendar-goto-iso-week Detlev Zundel
@ 2004-09-04 20:19 ` Emilio Lopes
1 sibling, 0 replies; 25+ messages in thread
From: Emilio Lopes @ 2004-09-04 20:19 UTC (permalink / raw)
Cc: Glenn Morris, Ed Reingold, emacs-devel
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)))
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: calendar-goto-iso-week
2004-09-04 16:39 ` calendar-goto-iso-week Detlev Zundel
@ 2004-09-05 19:15 ` Ed Reingold
2004-09-11 9:43 ` calendar-goto-iso-week Emilio Lopes
0 siblings, 1 reply; 25+ messages in thread
From: Ed Reingold @ 2004-09-05 19:15 UTC (permalink / raw)
Cc: Emilio Lopes, emacs-devel
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)
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: calendar-goto-iso-week
2004-09-05 19:15 ` calendar-goto-iso-week Ed Reingold
@ 2004-09-11 9:43 ` Emilio Lopes
2004-09-12 1:16 ` calendar-goto-iso-week Ed Reingold
0 siblings, 1 reply; 25+ messages in thread
From: Emilio Lopes @ 2004-09-11 9:43 UTC (permalink / raw)
Cc: Detlev Zundel, emacs-devel
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)))
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: calendar-goto-iso-week
2004-09-11 9:43 ` calendar-goto-iso-week Emilio Lopes
@ 2004-09-12 1:16 ` Ed Reingold
2004-09-12 12:38 ` calendar-goto-iso-week Emilio Lopes
0 siblings, 1 reply; 25+ messages in thread
From: Ed Reingold @ 2004-09-12 1:16 UTC (permalink / raw)
Cc: Detlev Zundel, emacs-devel
> > 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?
I prefer what I had because it is consistent with the other "go-to" date
functions.
> Also note the use of calendar-week-start-day bellow.
I did not use that because on the ISO calendar it is Monday that is the first
day of the week,; what is displayed is irrelevant--it is a matter of the ISO
definition!
>
>
> (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)))
>
>
>
> _______________________________________________
> Emacs-devel mailing list
> Emacs-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-devel
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: calendar-goto-iso-week
2004-09-12 1:16 ` calendar-goto-iso-week Ed Reingold
@ 2004-09-12 12:38 ` Emilio Lopes
2004-09-12 20:06 ` calendar-goto-iso-week Ed Reingold
0 siblings, 1 reply; 25+ messages in thread
From: Emilio Lopes @ 2004-09-12 12:38 UTC (permalink / raw)
Cc: Detlev Zundel, emacs-devel
Ed Reingold writes:
>> 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?
> I prefer what I had because it is consistent with the
> other "go-to" date functions.
OK, that's an argument.
>> Also note the use of calendar-week-start-day bellow.
> I did not use that because on the ISO calendar it is
> Monday that is the first day of the week,; what is
> displayed is irrelevant--it is a matter of the ISO
> definition!
I see, thanks for the info. Maybe one could put a comment
in the code explaining this for those of us not so familiar
with calendars?
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: calendar-goto-iso-week
2004-09-12 12:38 ` calendar-goto-iso-week Emilio Lopes
@ 2004-09-12 20:06 ` Ed Reingold
2004-09-13 19:50 ` calendar-goto-iso-week Emilio Lopes
0 siblings, 1 reply; 25+ messages in thread
From: Ed Reingold @ 2004-09-12 20:06 UTC (permalink / raw)
I am hoping that one of you will make the changes in the source--I haven't
done that in a long while and no longer remember where/how!
> Ed Reingold writes:
>
> >> 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?
>
> > I prefer what I had because it is consistent with the
> > other "go-to" date functions.
>
> OK, that's an argument.
>
> >> Also note the use of calendar-week-start-day bellow.
>
> > I did not use that because on the ISO calendar it is
> > Monday that is the first day of the week,; what is
> > displayed is irrelevant--it is a matter of the ISO
> > definition!
>
> I see, thanks for the info. Maybe one could put a comment
> in the code explaining this for those of us not so familiar
> with calendars?
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: calendar-goto-iso-week
2004-09-12 20:06 ` calendar-goto-iso-week Ed Reingold
@ 2004-09-13 19:50 ` Emilio Lopes
2004-09-13 19:58 ` calendar-goto-iso-week Ed Reingold
0 siblings, 1 reply; 25+ messages in thread
From: Emilio Lopes @ 2004-09-13 19:50 UTC (permalink / raw)
Cc: emacs-devel
Ed Reingold writes:
> I am hoping that one of you will make the changes in the
> source--I haven't done that in a long while and no longer
> remember where/how!
I don't have the time right now, but I'll post a patch with
your changes to emacs-devel in the next days. Some kind
soul with write access to the repository will then actually
check it in :-)
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: calendar-goto-iso-week
2004-09-13 19:50 ` calendar-goto-iso-week Emilio Lopes
@ 2004-09-13 19:58 ` Ed Reingold
0 siblings, 0 replies; 25+ messages in thread
From: Ed Reingold @ 2004-09-13 19:58 UTC (permalink / raw)
> Ed Reingold writes:
>
> > I am hoping that one of you will make the changes in the
> > source--I haven't done that in a long while and no longer
> > remember where/how!
>
> I don't have the time right now, but I'll post a patch with
> your changes to emacs-devel in the next days. Some kind
> soul with write access to the repository will then actually
> check it in :-)
Thanks for overseeing this addition!
^ permalink raw reply [flat|nested] 25+ messages in thread
* Patches to calendar
@ 2004-09-18 21:09 Emilio Lopes
2004-09-20 0:05 ` Richard Stallman
2004-09-20 22:20 ` Glenn Morris
0 siblings, 2 replies; 25+ messages in thread
From: Emilio Lopes @ 2004-09-18 21:09 UTC (permalink / raw)
Cc: Ed Reingold
Here are the patches to calendar as discussed with Ed Reingold.
Besides the new command `calendar-goto-iso-week' I also
unquoted all the lambda forms in the code, as suggested by
Stefan Monnier.
2004-09-18 Ed Reingold <reingold@emr.cs.iit.edu> and Emilio C. Lopes <eclig@gmx.net>
* calendar/cal-iso.el (calendar-goto-iso-week): New command.
* calendar/calendar.el (calendar-goto-iso-week): Added autoload.
* calendar/calendar.el (calendar-mode-map):
* calendar/cal-menu.el (calendar-mode-map): Added bindings for
`calendar-goto-iso-week'.
* calendar/cal-iso.el (calendar-goto-iso-date):
* calendar/calendar.el (mark-visible-calendar-date):
* calendar/cal-tex.el (cal-tex-hook)
(cal-tex-latexify-list):
* calendar/cal-persia.el (persian-prompt-for-date):
* calendar/cal-move.el (calendar-goto-day-of-year):
* calendar/cal-menu.el (calendar-mouse-holidays)
(calendar-mouse-view-diary-entries):
* calendar/cal-mayan.el (calendar-read-mayan-haab-date)
(calendar-read-mayan-tzolkin-date):
* calendar/cal-julian.el (calendar-goto-julian-date)
(calendar-goto-astro-day-number):
* calendar/cal-islam.el (calendar-goto-islamic-date):
* calendar/cal-hebrew.el (calendar-goto-hebrew-date)
(list-yahrzeit-dates):
* calendar/cal-french.el (calendar-goto-french-date):
* calendar/cal-coptic.el (coptic-prompt-for-date):
* calendar/cal-china.el (calendar-goto-chinese-date)
(chinese-months):
* calendar/cal-bahai.el (mark-bahai-diary-entries)
(bahai-prompt-for-date): unquoted `lambda' forms
Index: lisp/calendar/cal-bahai.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/calendar/cal-bahai.el,v
retrieving revision 1.6
diff -c -r1.6 cal-bahai.el
*** lisp/calendar/cal-bahai.el 9 May 2004 04:52:07 -0000 1.6
--- lisp/calendar/cal-bahai.el 18 Sep 2004 20:12:36 -0000
***************
*** 155,176 ****
(let* ((today (calendar-current-date))
(year (calendar-read
"Baha'i calendar year (not 0): "
! '(lambda (x) (/= x 0))
(int-to-string
(extract-calendar-year
(calendar-bahai-from-absolute
(calendar-absolute-from-gregorian today))))))
(completion-ignore-case t)
(month (cdr (assoc
! (completing-read
! "Baha'i calendar month name: "
! (mapcar 'list
! (append bahai-calendar-month-name-array nil))
! nil t)
(calendar-make-alist bahai-calendar-month-name-array
1))))
(day (calendar-read "Baha'i calendar day (1-19): "
! '(lambda (x) (and (< 0 x) (<= x 19))))))
(list (list month day year))))
(defun diary-bahai-date ()
--- 155,176 ----
(let* ((today (calendar-current-date))
(year (calendar-read
"Baha'i calendar year (not 0): "
! (lambda (x) (/= x 0))
(int-to-string
(extract-calendar-year
(calendar-bahai-from-absolute
(calendar-absolute-from-gregorian today))))))
(completion-ignore-case t)
(month (cdr (assoc
! (completing-read
! "Baha'i calendar month name: "
! (mapcar 'list
! (append bahai-calendar-month-name-array nil))
! nil t)
(calendar-make-alist bahai-calendar-month-name-array
1))))
(day (calendar-read "Baha'i calendar day (1-19): "
! (lambda (x) (and (< 0 x) (<= x 19))))))
(list (list month day year))))
(defun diary-bahai-date ()
***************
*** 379,385 ****
(calendar-make-alist
calendar-day-name-array
0
! '(lambda (x) (substring x 0 3))))))
(if mm-name
(if (string-equal mm-name "*")
(setq mm 0)
--- 379,385 ----
(calendar-make-alist
calendar-day-name-array
0
! (lambda (x) (substring x 0 3))))))
(if mm-name
(if (string-equal mm-name "*")
(setq mm 0)
Index: lisp/calendar/cal-china.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/calendar/cal-china.el,v
retrieving revision 1.18
diff -c -r1.18 cal-china.el
*** lisp/calendar/cal-china.el 1 Sep 2003 15:45:19 -0000 1.18
--- lisp/calendar/cal-china.el 18 Sep 2004 20:12:38 -0000
***************
*** 434,444 ****
(calendar-current-date))))
(cycle (calendar-read
"Chinese calendar cycle number (>44): "
! '(lambda (x) (> x 44))
(int-to-string (car c))))
(year (calendar-read
"Year in Chinese cycle (1..60): "
! '(lambda (x) (and (<= 1 x) (<= x 60)))
(int-to-string (car (cdr c)))))
(month-list (make-chinese-month-assoc-list
(chinese-months cycle year)))
--- 434,444 ----
(calendar-current-date))))
(cycle (calendar-read
"Chinese calendar cycle number (>44): "
! (lambda (x) (> x 44))
(int-to-string (car c))))
(year (calendar-read
"Year in Chinese cycle (1..60): "
! (lambda (x) (and (<= 1 x) (<= x 60)))
(int-to-string (car (cdr c)))))
(month-list (make-chinese-month-assoc-list
(chinese-months cycle year)))
***************
*** 456,462 ****
29))
(day (calendar-read
(format "Chinese calendar day (1-%d): " last)
! '(lambda (x) (and (<= 1 x) (<= x last))))))
(list (list cycle year month day))))
(calendar-goto-date (calendar-gregorian-from-absolute
(calendar-absolute-from-chinese date)))
--- 456,462 ----
29))
(day (calendar-read
(format "Chinese calendar day (1-%d): " last)
! (lambda (x) (and (<= 1 x) (<= x last))))))
(list (list cycle year month day))))
(calendar-goto-date (calendar-gregorian-from-absolute
(calendar-absolute-from-chinese date)))
***************
*** 465,478 ****
(defun chinese-months (c y)
"A list of the months in cycle C, year Y of the Chinese calendar."
(let* ((l (memq 1 (append
! (mapcar '(lambda (x)
! (car x))
(chinese-year (extract-calendar-year
(calendar-gregorian-from-absolute
(calendar-absolute-from-chinese
(list c y 1 1))))))
! (mapcar '(lambda (x)
! (if (> (car x) 11) (car x)))
(chinese-year (extract-calendar-year
(calendar-gregorian-from-absolute
(calendar-absolute-from-chinese
--- 465,478 ----
(defun chinese-months (c y)
"A list of the months in cycle C, year Y of the Chinese calendar."
(let* ((l (memq 1 (append
! (mapcar (lambda (x)
! (car x))
(chinese-year (extract-calendar-year
(calendar-gregorian-from-absolute
(calendar-absolute-from-chinese
(list c y 1 1))))))
! (mapcar (lambda (x)
! (if (> (car x) 11) (car x)))
(chinese-year (extract-calendar-year
(calendar-gregorian-from-absolute
(calendar-absolute-from-chinese
Index: lisp/calendar/cal-coptic.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/calendar/cal-coptic.el,v
retrieving revision 1.14
diff -c -r1.14 cal-coptic.el
*** lisp/calendar/cal-coptic.el 19 Feb 2004 01:15:03 -0000 1.14
--- lisp/calendar/cal-coptic.el 18 Sep 2004 20:12:38 -0000
***************
*** 145,151 ****
(let* ((today (calendar-current-date))
(year (calendar-read
(format "%s calendar year (>0): " coptic-name)
! '(lambda (x) (> x 0))
(int-to-string
(extract-calendar-year
(calendar-coptic-from-absolute
--- 145,151 ----
(let* ((today (calendar-current-date))
(year (calendar-read
(format "%s calendar year (>0): " coptic-name)
! (lambda (x) (> x 0))
(int-to-string
(extract-calendar-year
(calendar-coptic-from-absolute
***************
*** 162,168 ****
(last (coptic-calendar-last-day-of-month month year))
(day (calendar-read
(format "%s calendar day (1-%d): " coptic-name last)
! '(lambda (x) (and (< 0 x) (<= x last))))))
(list (list month day year))))
(defun diary-coptic-date ()
--- 162,168 ----
(last (coptic-calendar-last-day-of-month month year))
(day (calendar-read
(format "%s calendar day (1-%d): " coptic-name last)
! (lambda (x) (and (< 0 x) (<= x last))))))
(list (list month day year))))
(defun diary-coptic-date ()
Index: lisp/calendar/cal-french.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/calendar/cal-french.el,v
retrieving revision 1.27
diff -c -r1.27 cal-french.el
*** lisp/calendar/cal-french.el 19 Feb 2004 01:15:40 -0000 1.27
--- lisp/calendar/cal-french.el 18 Sep 2004 20:12:39 -0000
***************
*** 206,213 ****
(calendar-read
(if accents
"Année de la Révolution (>0): "
! "Anne'e de la Re'volution (>0): ")
! '(lambda (x) (> x 0))
(int-to-string
(extract-calendar-year
(calendar-french-from-absolute
--- 206,213 ----
(calendar-read
(if accents
"Année de la Révolution (>0): "
! "Anne'e de la Re'volution (>0): ")
! (lambda (x) (> x 0))
(int-to-string
(extract-calendar-year
(calendar-french-from-absolute
***************
*** 218,231 ****
(append months
(if (french-calendar-leap-year-p year)
(mapcar
! '(lambda (x) (concat "Jour " x))
french-calendar-special-days-array)
(reverse
! (cdr;; we don't want rev. day in a non-leap yr.
(reverse
(mapcar
! '(lambda (x)
! (concat "Jour " x))
special-days))))))))
(completion-ignore-case t)
(month (cdr (assoc-string
--- 218,231 ----
(append months
(if (french-calendar-leap-year-p year)
(mapcar
! (lambda (x) (concat "Jour " x))
french-calendar-special-days-array)
(reverse
! (cdr ;; we don't want rev. day in a non-leap yr.
(reverse
(mapcar
! (lambda (x)
! (concat "Jour " x))
special-days))))))))
(completion-ignore-case t)
(month (cdr (assoc-string
***************
*** 238,244 ****
(- month 12)
(calendar-read
"Jour (1-30): "
! '(lambda (x) (and (<= 1 x) (<= x 30))))))
(month (if (> month 12) 13 month)))
(list (list month day year)))))
(calendar-goto-date (calendar-gregorian-from-absolute
--- 238,244 ----
(- month 12)
(calendar-read
"Jour (1-30): "
! (lambda (x) (and (<= 1 x) (<= x 30))))))
(month (if (> month 12) 13 month)))
(list (list month day year)))))
(calendar-goto-date (calendar-gregorian-from-absolute
Index: lisp/calendar/cal-hebrew.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/calendar/cal-hebrew.el,v
retrieving revision 1.18
diff -c -r1.18 cal-hebrew.el
*** lisp/calendar/cal-hebrew.el 19 Feb 2004 01:16:53 -0000 1.18
--- lisp/calendar/cal-hebrew.el 18 Sep 2004 20:12:43 -0000
***************
*** 227,233 ****
(let* ((today (calendar-current-date))
(year (calendar-read
"Hebrew calendar year (>3760): "
! '(lambda (x) (> x 3760))
(int-to-string
(extract-calendar-year
(calendar-hebrew-from-absolute
--- 227,233 ----
(let* ((today (calendar-current-date))
(year (calendar-read
"Hebrew calendar year (>3760): "
! (lambda (x) (> x 3760))
(int-to-string
(extract-calendar-year
(calendar-hebrew-from-absolute
***************
*** 241,258 ****
"Hebrew calendar month name: "
(mapcar 'list (append month-array nil))
(if (= year 3761)
! '(lambda (x)
! (let ((m (cdr
! (assoc-string
! (car x)
! (calendar-make-alist month-array)
! t))))
! (< 0
! (calendar-absolute-from-hebrew
! (list m
! (hebrew-calendar-last-day-of-month
! m year)
! year))))))
t)
(calendar-make-alist month-array 1) t)))
(last (hebrew-calendar-last-day-of-month month year))
--- 241,258 ----
"Hebrew calendar month name: "
(mapcar 'list (append month-array nil))
(if (= year 3761)
! (lambda (x)
! (let ((m (cdr
! (assoc-string
! (car x)
! (calendar-make-alist month-array)
! t))))
! (< 0
! (calendar-absolute-from-hebrew
! (list m
! (hebrew-calendar-last-day-of-month
! m year)
! year))))))
t)
(calendar-make-alist month-array 1) t)))
(last (hebrew-calendar-last-day-of-month month year))
***************
*** 261,267 ****
(day (calendar-read
(format "Hebrew calendar day (%d-%d): "
first last)
! '(lambda (x) (and (<= first x) (<= x last))))))
(list (list month day year))))
(calendar-goto-date (calendar-gregorian-from-absolute
(calendar-absolute-from-hebrew date)))
--- 261,267 ----
(day (calendar-read
(format "Hebrew calendar day (%d-%d): "
first last)
! (lambda (x) (and (<= first x) (<= x last))))))
(list (list month day year))))
(calendar-goto-date (calendar-gregorian-from-absolute
(calendar-absolute-from-hebrew date)))
***************
*** 835,841 ****
(let* ((today (calendar-current-date))
(year (calendar-read
"Year of death (>0): "
! '(lambda (x) (> x 0))
(int-to-string (extract-calendar-year today))))
(month-array calendar-month-name-array)
(completion-ignore-case t)
--- 835,841 ----
(let* ((today (calendar-current-date))
(year (calendar-read
"Year of death (>0): "
! (lambda (x) (> x 0))
(int-to-string (extract-calendar-year today))))
(month-array calendar-month-name-array)
(completion-ignore-case t)
***************
*** 848,865 ****
(last (calendar-last-day-of-month month year))
(day (calendar-read
(format "Day of death (1-%d): " last)
! '(lambda (x) (and (< 0 x) (<= x last))))))
(list month day year))))
(death-year (extract-calendar-year death-date))
(start-year (calendar-read
(format "Starting year of Yahrzeit table (>%d): "
death-year)
! '(lambda (x) (> x death-year))
(int-to-string (1+ death-year))))
(end-year (calendar-read
(format "Ending year of Yahrzeit table (>=%d): "
start-year)
! '(lambda (x) (>= x start-year)))))
(list death-date start-year end-year)))
(message "Computing yahrzeits...")
(let* ((yahrzeit-buffer "*Yahrzeits*")
--- 848,865 ----
(last (calendar-last-day-of-month month year))
(day (calendar-read
(format "Day of death (1-%d): " last)
! (lambda (x) (and (< 0 x) (<= x last))))))
(list month day year))))
(death-year (extract-calendar-year death-date))
(start-year (calendar-read
(format "Starting year of Yahrzeit table (>%d): "
death-year)
! (lambda (x) (> x death-year))
(int-to-string (1+ death-year))))
(end-year (calendar-read
(format "Ending year of Yahrzeit table (>=%d): "
start-year)
! (lambda (x) (>= x start-year)))))
(list death-date start-year end-year)))
(message "Computing yahrzeits...")
(let* ((yahrzeit-buffer "*Yahrzeits*")
Index: lisp/calendar/cal-islam.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/calendar/cal-islam.el,v
retrieving revision 1.14
diff -c -r1.14 cal-islam.el
*** lisp/calendar/cal-islam.el 19 Feb 2004 01:17:44 -0000 1.14
--- lisp/calendar/cal-islam.el 18 Sep 2004 20:12:45 -0000
***************
*** 147,153 ****
(let* ((today (calendar-current-date))
(year (calendar-read
"Islamic calendar year (>0): "
! '(lambda (x) (> x 0))
(int-to-string
(extract-calendar-year
(calendar-islamic-from-absolute
--- 147,153 ----
(let* ((today (calendar-current-date))
(year (calendar-read
"Islamic calendar year (>0): "
! (lambda (x) (> x 0))
(int-to-string
(extract-calendar-year
(calendar-islamic-from-absolute
***************
*** 163,169 ****
(last (islamic-calendar-last-day-of-month month year))
(day (calendar-read
(format "Islamic calendar day (1-%d): " last)
! '(lambda (x) (and (< 0 x) (<= x last))))))
(list (list month day year))))
(calendar-goto-date (calendar-gregorian-from-absolute
(calendar-absolute-from-islamic date)))
--- 163,169 ----
(last (islamic-calendar-last-day-of-month month year))
(day (calendar-read
(format "Islamic calendar day (1-%d): " last)
! (lambda (x) (and (< 0 x) (<= x last))))))
(list (list month day year))))
(calendar-goto-date (calendar-gregorian-from-absolute
(calendar-absolute-from-islamic date)))
Index: lisp/calendar/cal-iso.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/calendar/cal-iso.el,v
retrieving revision 1.6
diff -c -r1.6 cal-iso.el
*** lisp/calendar/cal-iso.el 1 Sep 2003 15:45:19 -0000 1.6
--- lisp/calendar/cal-iso.el 18 Sep 2004 20:12:45 -0000
***************
*** 102,108 ****
(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
--- 102,108 ----
(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
***************
*** 112,126 ****
(list 1 4 (1+ year))))))))
(week (calendar-read
(format "ISO calendar week (1-%d): " no-weeks)
! '(lambda (x) (and (> x 0) (<= x no-weeks)))))
(day (calendar-read
"ISO day (1-7): "
! '(lambda (x) (and (<= 1 x) (<= x 7))))))
(list (list week day year))))
(calendar-goto-date (calendar-gregorian-from-absolute
(calendar-absolute-from-iso date)))
(or noecho (calendar-print-iso-date)))
(defun diary-iso-date ()
"ISO calendar equivalent of date diary entry."
(format "ISO date: %s" (calendar-iso-date-string date)))
--- 112,148 ----
(list 1 4 (1+ year))))))))
(week (calendar-read
(format "ISO calendar week (1-%d): " no-weeks)
! (lambda (x) (and (> x 0) (<= x no-weeks)))))
(day (calendar-read
"ISO day (1-7): "
! (lambda (x) (and (<= 1 x) (<= x 7))))))
(list (list week day year))))
(calendar-goto-date (calendar-gregorian-from-absolute
(calendar-absolute-from-iso date)))
(or noecho (calendar-print-iso-date)))
+ (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)))
+
(defun diary-iso-date ()
"ISO calendar equivalent of date diary entry."
(format "ISO date: %s" (calendar-iso-date-string date)))
Index: lisp/calendar/cal-julian.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/calendar/cal-julian.el,v
retrieving revision 1.12
diff -c -r1.12 cal-julian.el
*** lisp/calendar/cal-julian.el 19 Feb 2004 01:18:23 -0000 1.12
--- lisp/calendar/cal-julian.el 18 Sep 2004 20:12:46 -0000
***************
*** 107,113 ****
(let* ((today (calendar-current-date))
(year (calendar-read
"Julian calendar year (>0): "
! '(lambda (x) (> x 0))
(int-to-string
(extract-calendar-year
(calendar-julian-from-absolute
--- 107,113 ----
(let* ((today (calendar-current-date))
(year (calendar-read
"Julian calendar year (>0): "
! (lambda (x) (> x 0))
(int-to-string
(extract-calendar-year
(calendar-julian-from-absolute
***************
*** 116,125 ****
(month-array calendar-month-name-array)
(completion-ignore-case t)
(month (cdr (assoc-string
! (completing-read
! "Julian calendar month name: "
! (mapcar 'list (append month-array nil))
! nil t)
(calendar-make-alist month-array 1) t)))
(last
(if (and (zerop (% year 4)) (= month 2))
--- 116,125 ----
(month-array calendar-month-name-array)
(completion-ignore-case t)
(month (cdr (assoc-string
! (completing-read
! "Julian calendar month name: "
! (mapcar 'list (append month-array nil))
! nil t)
(calendar-make-alist month-array 1) t)))
(last
(if (and (zerop (% year 4)) (= month 2))
***************
*** 128,136 ****
(day (calendar-read
(format "Julian calendar day (%d-%d): "
(if (and (= year 1) (= month 1)) 3 1) last)
! '(lambda (x)
! (and (< (if (and (= year 1) (= month 1)) 2 0) x)
! (<= x last))))))
(list (list month day year))))
(calendar-goto-date (calendar-gregorian-from-absolute
(calendar-absolute-from-julian date)))
--- 128,136 ----
(day (calendar-read
(format "Julian calendar day (%d-%d): "
(if (and (= year 1) (= month 1)) 3 1) last)
! (lambda (x)
! (and (< (if (and (= year 1) (= month 1)) 2 0) x)
! (<= x last))))))
(list (list month day year))))
(calendar-goto-date (calendar-gregorian-from-absolute
(calendar-absolute-from-julian date)))
***************
*** 196,202 ****
Echo astronomical (Julian) day number unless NOECHO is t."
(interactive (list (calendar-read
"Astronomical (Julian) day number (>1721425): "
! '(lambda (x) (> x 1721425)))))
(calendar-goto-date
(calendar-gregorian-from-absolute
(floor
--- 196,202 ----
Echo astronomical (Julian) day number unless NOECHO is t."
(interactive (list (calendar-read
"Astronomical (Julian) day number (>1721425): "
! (lambda (x) (> x 1721425)))))
(calendar-goto-date
(calendar-gregorian-from-absolute
(floor
Index: lisp/calendar/cal-mayan.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/calendar/cal-mayan.el,v
retrieving revision 1.22
diff -c -r1.22 cal-mayan.el
*** lisp/calendar/cal-mayan.el 19 Feb 2004 01:19:05 -0000 1.22
--- lisp/calendar/cal-mayan.el 18 Sep 2004 20:12:47 -0000
***************
*** 252,258 ****
(let* ((completion-ignore-case t)
(haab-day (calendar-read
"Haab kin (0-19): "
! '(lambda (x) (and (>= x 0) (< x 20)))))
(haab-month-list (append calendar-mayan-haab-month-name-array
(and (< haab-day 5) '("Uayeb"))))
(haab-month (cdr
--- 252,258 ----
(let* ((completion-ignore-case t)
(haab-day (calendar-read
"Haab kin (0-19): "
! (lambda (x) (and (>= x 0) (< x 20)))))
(haab-month-list (append calendar-mayan-haab-month-name-array
(and (< haab-day 5) '("Uayeb"))))
(haab-month (cdr
***************
*** 268,274 ****
(let* ((completion-ignore-case t)
(tzolkin-count (calendar-read
"Tzolkin kin (1-13): "
! '(lambda (x) (and (> x 0) (< x 14)))))
(tzolkin-name-list (append calendar-mayan-tzolkin-names-array nil))
(tzolkin-name (cdr
(assoc-string
--- 268,274 ----
(let* ((completion-ignore-case t)
(tzolkin-count (calendar-read
"Tzolkin kin (1-13): "
! (lambda (x) (and (> x 0) (< x 14)))))
(tzolkin-name-list (append calendar-mayan-tzolkin-names-array nil))
(tzolkin-name (cdr
(assoc-string
Index: lisp/calendar/cal-menu.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/calendar/cal-menu.el,v
retrieving revision 1.54
diff -c -r1.54 cal-menu.el
*** lisp/calendar/cal-menu.el 8 May 2004 12:42:07 -0000 1.54
--- lisp/calendar/cal-menu.el 18 Sep 2004 20:12:48 -0000
***************
*** 119,124 ****
--- 119,126 ----
'("Hebrew Date" . calendar-goto-hebrew-date))
(define-key calendar-mode-map [menu-bar goto astro]
'("Astronomical Date" . calendar-goto-astro-day-number))
+ (define-key calendar-mode-map [menu-bar goto iso-week]
+ '("ISO Week" . calendar-goto-iso-week))
(define-key calendar-mode-map [menu-bar goto iso]
'("ISO Date" . calendar-goto-iso-date))
(define-key calendar-mode-map [menu-bar goto day-of-year]
***************
*** 323,329 ****
"Pop up menu of holidays for mouse selected date."
(interactive)
(let* ((date (calendar-event-to-date))
! (l (mapcar '(lambda (x) (list x))
(check-calendar-holidays date)))
(selection
(cal-menu-x-popup-menu
--- 325,331 ----
"Pop up menu of holidays for mouse selected date."
(interactive)
(let* ((date (calendar-event-to-date))
! (l (mapcar (lambda (x) (list x))
(check-calendar-holidays date)))
(selection
(cal-menu-x-popup-menu
***************
*** 346,355 ****
(diary-list-include-blanks nil)
(diary-display-hook 'ignore)
(diary-entries
! (mapcar '(lambda (x) (split-string (car (cdr x)) "\^M\\|\n"))
(list-diary-entries date 1)))
(holidays (if holidays-in-diary-buffer
! (mapcar '(lambda (x) (list x))
(check-calendar-holidays date))))
(title (concat "Diary entries "
(if diary (format "from %s " diary) "")
--- 348,357 ----
(diary-list-include-blanks nil)
(diary-display-hook 'ignore)
(diary-entries
! (mapcar (lambda (x) (split-string (car (cdr x)) "\^M\\|\n"))
(list-diary-entries date 1)))
(holidays (if holidays-in-diary-buffer
! (mapcar (lambda (x) (list x))
(check-calendar-holidays date))))
(title (concat "Diary entries "
(if diary (format "from %s " diary) "")
***************
*** 362,368 ****
(append
(list title)
(if holidays
! (mapcar '(lambda (x) (list (concat " " (car x))))
holidays))
(if holidays
(list "--shadow-etched-in" "--shadow-etched-in"))
--- 364,370 ----
(append
(list title)
(if holidays
! (mapcar (lambda (x) (list (concat " " (car x))))
holidays))
(if holidays
(list "--shadow-etched-in" "--shadow-etched-in"))
Index: lisp/calendar/cal-move.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/calendar/cal-move.el,v
retrieving revision 1.9
diff -c -r1.9 cal-move.el
*** lisp/calendar/cal-move.el 1 Sep 2003 15:45:19 -0000 1.9
--- lisp/calendar/cal-move.el 18 Sep 2004 20:12:49 -0000
***************
*** 339,345 ****
(last (if (calendar-leap-year-p year) 366 365))
(day (calendar-read
(format "Day number (+/- 1-%d): " last)
! '(lambda (x) (and (<= 1 (abs x)) (<= (abs x) last))))))
(list year day)))
(calendar-goto-date
(calendar-gregorian-from-absolute
--- 339,345 ----
(last (if (calendar-leap-year-p year) 366 365))
(day (calendar-read
(format "Day number (+/- 1-%d): " last)
! (lambda (x) (and (<= 1 (abs x)) (<= (abs x) last))))))
(list year day)))
(calendar-goto-date
(calendar-gregorian-from-absolute
Index: lisp/calendar/cal-persia.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/calendar/cal-persia.el,v
retrieving revision 1.8
diff -c -r1.8 cal-persia.el
*** lisp/calendar/cal-persia.el 1 Sep 2003 15:45:19 -0000 1.8
--- lisp/calendar/cal-persia.el 18 Sep 2004 20:12:50 -0000
***************
*** 180,186 ****
(let* ((today (calendar-current-date))
(year (calendar-read
"Persian calendar year (not 0): "
! '(lambda (x) (/= x 0))
(int-to-string
(extract-calendar-year
(calendar-persian-from-absolute
--- 180,186 ----
(let* ((today (calendar-current-date))
(year (calendar-read
"Persian calendar year (not 0): "
! (lambda (x) (/= x 0))
(int-to-string
(extract-calendar-year
(calendar-persian-from-absolute
***************
*** 197,203 ****
(last (persian-calendar-last-day-of-month month year))
(day (calendar-read
(format "Persian calendar day (1-%d): " last)
! '(lambda (x) (and (< 0 x) (<= x last))))))
(list (list month day year))))
(defun diary-persian-date ()
--- 197,203 ----
(last (persian-calendar-last-day-of-month month year))
(day (calendar-read
(format "Persian calendar day (1-%d): " last)
! (lambda (x) (and (< 0 x) (<= x last))))))
(list (list month day year))))
(defun diary-persian-date ()
Index: lisp/calendar/cal-tex.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/calendar/cal-tex.el,v
retrieving revision 1.25
diff -c -r1.25 cal-tex.el
*** lisp/calendar/cal-tex.el 1 Sep 2003 15:45:19 -0000 1.25
--- lisp/calendar/cal-tex.el 18 Sep 2004 20:12:53 -0000
***************
*** 124,130 ****
You can use this to do postprocessing on the buffer. For example, to change
characters with diacritical marks to their LaTeX equivalents, use
(add-hook 'cal-tex-hook
! '(lambda () (iso-iso2tex (point-min) (point-max))))"
:type 'hook
:group 'calendar-tex)
--- 124,130 ----
You can use this to do postprocessing on the buffer. For example, to change
characters with diacritical marks to their LaTeX equivalents, use
(add-hook 'cal-tex-hook
! (lambda () (iso-iso2tex (point-min) (point-max))))"
:type 'hook
:group 'calendar-tex)
***************
*** 1504,1510 ****
FINAL-SEPARATOR is t."
(let* ((sep (if separator separator "\\\\"))
(result
! (mapconcat '(lambda (x) (cal-tex-LaTeXify-string x))
(let ((result)
(p date-list))
(while p
--- 1504,1510 ----
FINAL-SEPARATOR is t."
(let* ((sep (if separator separator "\\\\"))
(result
! (mapconcat (lambda (x) (cal-tex-LaTeXify-string x))
(let ((result)
(p date-list))
(while p
Index: lisp/calendar/calendar.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/calendar/calendar.el,v
retrieving revision 1.157
diff -c -r1.157 calendar.el
*** lisp/calendar/calendar.el 8 May 2004 12:42:07 -0000 1.157
--- lisp/calendar/calendar.el 18 Sep 2004 20:13:04 -0000
***************
*** 1738,1743 ****
--- 1738,1747 ----
"Move cursor to ISO date."
t)
+ (autoload 'calendar-goto-iso-week "cal-iso"
+ "Move cursor to start of ISO WEEK in YEAR."
+ t)
+
(autoload 'calendar-print-iso-date "cal-iso"
"Show the ISO date equivalents of date."
t)
***************
*** 2173,2178 ****
--- 2177,2183 ----
(define-key calendar-mode-map "ge" 'calendar-goto-ethiopic-date)
(define-key calendar-mode-map "gp" 'calendar-goto-persian-date)
(define-key calendar-mode-map "gc" 'calendar-goto-iso-date)
+ (define-key calendar-mode-map "gw" 'calendar-goto-iso-week)
(define-key calendar-mode-map "gf" 'calendar-goto-french-date)
(define-key calendar-mode-map "gml" 'calendar-goto-mayan-long-count-date)
(define-key calendar-mode-map "gmpc" 'calendar-previous-calendar-round-date)
***************
*** 2857,2863 ****
(and (facep mark) mark) ; face-name
diary-entry-marker)))
(if (facep mark)
! (progn ; face or an attr-list that contained a face
(overlay-put
(make-overlay (1- (point)) (1+ (point))) 'face mark))
(if (and (stringp mark)
--- 2862,2868 ----
(and (facep mark) mark) ; face-name
diary-entry-marker)))
(if (facep mark)
! (progn ; face or an attr-list that contained a face
(overlay-put
(make-overlay (1- (point)) (1+ (point))) 'face mark))
(if (and (stringp mark)
***************
*** 2867,2879 ****
(delete-char 1)
(insert mark)
(forward-char -2))
! (let ; attr list
((temp-face
(make-symbol (apply 'concat "temp-face-"
! (mapcar '(lambda (sym)
! (cond ((symbolp sym) (symbol-name sym))
! ((numberp sym) (int-to-string sym))
! (t sym))) mark))))
(faceinfo mark))
(make-face temp-face)
;; Remove :face info from the mark, copy the face info into temp-face
--- 2872,2884 ----
(delete-char 1)
(insert mark)
(forward-char -2))
! (let ; attr list
((temp-face
(make-symbol (apply 'concat "temp-face-"
! (mapcar (lambda (sym)
! (cond ((symbolp sym) (symbol-name sym))
! ((numberp sym) (int-to-string sym))
! (t sym))) mark))))
(faceinfo mark))
(make-face temp-face)
;; Remove :face info from the mark, copy the face info into temp-face
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: Patches to calendar
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-20 22:20 ` Glenn Morris
1 sibling, 2 replies; 25+ messages in thread
From: Richard Stallman @ 2004-09-20 0:05 UTC (permalink / raw)
Cc: reingold, emacs-devel
We should not install this without adding an item to etc/NEWS.
Could you send that, please?
Also, could you write changes for the Emacs Manual?
Don't worry about making them publication-quality English,
just make them correct. I will polish them up later.
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: Patches to calendar
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
1 sibling, 1 reply; 25+ messages in thread
From: Emilio Lopes @ 2004-09-20 20:57 UTC (permalink / raw)
Richard Stallman writes:
> We should not install this without adding an item to
> etc/NEWS. Could you send that, please?
Is the following appropriate?
** The new Calendar function `calendar-goto-iso-week' (g w)
prompts for a year and a week number, and moves to the first
day of that ISO week.
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: Patches to calendar
2004-09-20 0:05 ` Richard Stallman
@ 2004-09-20 20:57 ` Emilio Lopes
2004-09-20 20:57 ` Emilio Lopes
1 sibling, 0 replies; 25+ messages in thread
From: Emilio Lopes @ 2004-09-20 20:57 UTC (permalink / raw)
Richard Stallman writes:
> We should not install this without adding an item to
> etc/NEWS. Could you send that, please?
Is the following appropriate?
** The new Calendar function `calendar-goto-iso-week' (g w)
prompts for a year and a week number, and moves to the first
day of that ISO week.
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: Patches to calendar
2004-09-18 21:09 Patches to calendar Emilio Lopes
2004-09-20 0:05 ` Richard Stallman
@ 2004-09-20 22:20 ` Glenn Morris
2004-09-20 22:34 ` Miles Bader
2004-09-21 11:35 ` Emilio C. Lopes
1 sibling, 2 replies; 25+ messages in thread
From: Glenn Morris @ 2004-09-20 22:20 UTC (permalink / raw)
Cc: eclig
(with-calendar-maintainer-hat ... )
Sorry to come late to this discussion.
Emilio Lopes wrote:
> Here are the patches to calendar as discussed with Ed Reingold.
>
> Besides the new command `calendar-goto-iso-week'
I don't think it's worth adding a whole new function which duplicates
practically the entire code from calendar-goto-iso-date, just for
this.
Instead, I'm minded to just make calendar-goto-iso-date default to 1
for the day of the week. The UI difference between that and
`calendar-goto-iso-week' would just be a matter of pressing RET once
more.
We could have
(defalias 'calendar-goto-iso-week 'calendar-goto-iso-date)
if people really think it necessary.
> I also unquoted all the lambda forms in the code, as suggested by
> Stefan Monnier.
I'm not going to make that change unless a pressing need is felt to
change every such instance in Emacs; in which case it's the kind of
thing that might as well be done in one fell swoop, IMO.
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: Patches to calendar
2004-09-20 22:20 ` Glenn Morris
@ 2004-09-20 22:34 ` Miles Bader
2004-09-20 22:52 ` Glenn Morris
2004-09-21 11:35 ` Emilio C. Lopes
1 sibling, 1 reply; 25+ messages in thread
From: Miles Bader @ 2004-09-20 22:34 UTC (permalink / raw)
On Mon, Sep 20, 2004 at 11:20:26PM +0100, Glenn Morris wrote:
> > I also unquoted all the lambda forms in the code, as suggested by
> > Stefan Monnier.
>
> I'm not going to make that change unless a pressing need is felt to
> change every such instance in Emacs; in which case it's the kind of
> thing that might as well be done in one fell swoop, IMO.
I think there's no real advantage to doing "all of emacs" at once. For
packages that have a maintainer this sort of thing should probably be done on
a per-package basis at a time when the maintainer feels things are "stable"
(the main point being to avoid any conflict with external patches).
It probably _is_ better to not combine such changes with other feature
changes though. If CVS were changeset-oriented, you'd at least want to make
them separate changesets.
-Miles
--
We have met the enemy, and he is us. -- Pogo
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: Patches to calendar
2004-09-20 22:34 ` Miles Bader
@ 2004-09-20 22:52 ` Glenn Morris
2004-09-20 23:05 ` Miles Bader
0 siblings, 1 reply; 25+ messages in thread
From: Glenn Morris @ 2004-09-20 22:52 UTC (permalink / raw)
Cc: eclig, emacs-devel
Miles Bader wrote:
> I think there's no real advantage to doing "all of emacs" at once.
> For packages that have a maintainer this sort of thing should
> probably be done on a per-package basis at a time when the
> maintainer feels things are "stable" (the main point being to avoid
> any conflict with external patches).
OK. I was remembering the Great Trailing Whitespace Purge.
> It probably _is_ better to not combine such changes with other feature
> changes though.
Gotcha.
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: Patches to calendar
2004-09-20 22:52 ` Glenn Morris
@ 2004-09-20 23:05 ` Miles Bader
0 siblings, 0 replies; 25+ messages in thread
From: Miles Bader @ 2004-09-20 23:05 UTC (permalink / raw)
On Mon, Sep 20, 2004 at 11:52:27PM +0100, Glenn Morris wrote:
> > I think there's no real advantage to doing "all of emacs" at once.
> > For packages that have a maintainer this sort of thing should
> > probably be done on a per-package basis at a time when the
> > maintainer feels things are "stable" (the main point being to avoid
> > any conflict with external patches).
>
> OK. I was remembering the Great Trailing Whitespace Purge.
I think was a different sort of thing (and was a really dumb idea) because it
touched _so_ much code. There are relatively few lambdas around, especially
if you only count those that are in that form (simple quote), and changing
them actually does have some benefit.
-Miles
--
Quidquid latine dictum sit, altum viditur.
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: Patches to calendar
2004-09-20 22:20 ` Glenn Morris
2004-09-20 22:34 ` Miles Bader
@ 2004-09-21 11:35 ` Emilio C. Lopes
2004-09-21 14:10 ` Ed Reingold
2004-09-28 17:48 ` Glenn Morris
1 sibling, 2 replies; 25+ messages in thread
From: Emilio C. Lopes @ 2004-09-21 11:35 UTC (permalink / raw)
Glenn Morris wrote:
> Emilio Lopes wrote:
>> Besides the new command `calendar-goto-iso-week'
>
> I don't think it's worth adding a whole new function which duplicates
> practically the entire code from calendar-goto-iso-date, just for
> this.
It's a matter of convenience. Of course one could also use
`calendar-forward-week' with an appropriate argument, but that's not
something you want to do when you're on the phone and somebody asks if
week 42 is ok.
Indeed, the original code I posted to gnu.emacs.sources asked the user
only for the ISO week _in the current year_ to jump to. But for
consistence with other Calendar functions Ed Reingolg prefered to also
ask the user for the year, offering the current one as default.
But you are of course right; there's a lot of code duplication between
`calendar-goto-iso-date' and `calendar-goto-iso-week'. I tried to
change this in the code at the end of this message. Please let me
know if you find that better.
> Instead, I'm minded to just make calendar-goto-iso-date default to 1
> for the day of the week. The UI difference between that and
> `calendar-goto-iso-week' would just be a matter of pressing RET once
> more.
It depends on how often do you use the function. Here in Germany
ISO weeks are *heavily* used, so any unnecessary keystroke is just
annoying. That's why I wrote the code.
Some people who found the code useful have never known that
`calendar-goto-iso-date' asked for "our" calendar week.
So
> (defalias 'calendar-goto-iso-week 'calendar-goto-iso-date)
is the very least one should do.
Here is the "refactored" code:
(defun calendar-current-year ()
"Return the current year."
(extract-calendar-year (calendar-current-date)))
(defun calendar-weeks-in-year (year)
(extract-calendar-month
(calendar-iso-from-absolute
(1-
(calendar-dayname-on-or-before
1
(calendar-absolute-from-gregorian (list 1 4 (1+ year))))))))
(defun calendar-goto-iso-date (date &optional noecho)
"Move cursor to ISO DATE; echo ISO date unless NOECHO is t."
(interactive
(let* ((year (calendar-read
"ISO calendar year (>0): "
(lambda (x) (> x 0))
(int-to-string (calendar-current-year))))
(no-weeks (calendar-weeks-in-year year))
(week (calendar-read
(format "ISO calendar week (1-%d): " no-weeks)
(lambda (x) (and (> x 0) (<= x no-weeks)))))
(day (calendar-read
"ISO day (1-7): "
(lambda (x) (and (<= 1 x) (<= x 7))))))
(list (list week day year))))
(calendar-goto-date (calendar-gregorian-from-absolute
(calendar-absolute-from-iso date)))
(unless noecho (calendar-print-iso-date)))
(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* ((year (calendar-read
"ISO calendar year (>0): "
(lambda (x) (> x 0))
(int-to-string (calendar-current-year))))
(no-weeks (calendar-weeks-in-year 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 1 year) noecho))
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: Patches to calendar
2004-09-21 11:35 ` Emilio C. Lopes
@ 2004-09-21 14:10 ` Ed Reingold
2004-09-28 17:48 ` Glenn Morris
1 sibling, 0 replies; 25+ messages in thread
From: Ed Reingold @ 2004-09-21 14:10 UTC (permalink / raw)
Cc: emacs-devel
> Glenn Morris wrote:
>
> > Emilio Lopes wrote:
>
> >> Besides the new command `calendar-goto-iso-week'
> >
> > I don't think it's worth adding a whole new function which duplicates
> > practically the entire code from calendar-goto-iso-date, just for
> > this.
I prefer the code as proposed last, not the version Emilio included in the
last message: it is cleaner and consistent with other code. There is no
justification to omitting a useful function just because it it is similar to
an existing one. The calendar code contains many "go-to date" functions that
are similar, but useful.
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: Patches to calendar
2004-09-20 20:57 ` Emilio Lopes
@ 2004-09-22 7:11 ` Richard Stallman
2004-09-22 19:25 ` Emilio Lopes
0 siblings, 1 reply; 25+ messages in thread
From: Richard Stallman @ 2004-09-22 7:11 UTC (permalink / raw)
Cc: emacs-devel
Is the following appropriate?
** The new Calendar function `calendar-goto-iso-week' (g w)
prompts for a year and a week number, and moves to the first
day of that ISO week.
It is written the right way. If you are adding this to the manual
at the same time, put +++ in front of it.
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: Patches to calendar
2004-09-22 7:11 ` Richard Stallman
@ 2004-09-22 19:25 ` Emilio Lopes
0 siblings, 0 replies; 25+ messages in thread
From: Emilio Lopes @ 2004-09-22 19:25 UTC (permalink / raw)
Cc: emacs-devel
Richard Stallman writes:
> Is the following appropriate?
> [...]
> It is written the right way. If you are adding this to
> the manual at the same time, put +++ in front of it.
OK, I see. I've just read the note in the CVS News file.
Thanks for your patience.
Here is the new entry:
+++
** The new Calendar function `calendar-goto-iso-week' (g w)
prompts for a year and a week number, and moves to the first
day of that ISO week.
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: Patches to calendar
2004-09-21 11:35 ` Emilio C. Lopes
2004-09-21 14:10 ` Ed Reingold
@ 2004-09-28 17:48 ` Glenn Morris
1 sibling, 0 replies; 25+ messages in thread
From: Glenn Morris @ 2004-09-28 17:48 UTC (permalink / raw)
Cc: emacs-devel
"Emilio C. Lopes" wrote:
> Here is the "refactored" code:
Thanks for that. What do you think of this version?
Index: cal-iso.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/calendar/cal-iso.el,v
retrieving revision 1.6
diff -c -w -c -r1.6 cal-iso.el
*** cal-iso.el 1 Sep 2003 15:45:19 -0000 1.6
--- cal-iso.el 28 Sep 2004 17:43:37 -0000
***************
*** 96,104 ****
(message "ISO date: %s"
(calendar-iso-date-string (calendar-cursor-to-date t))))
! (defun calendar-goto-iso-date (date &optional noecho)
! "Move cursor to ISO DATE; echo ISO date unless NOECHO is t."
! (interactive
(let* ((today (calendar-current-date))
(year (calendar-read
"ISO calendar year (>0): "
--- 96,103 ----
(message "ISO date: %s"
(calendar-iso-date-string (calendar-cursor-to-date t))))
! (defun calendar-iso-read-args (&optional dayflag)
! "Interactively read the arguments for an iso date command."
(let* ((today (calendar-current-date))
(year (calendar-read
"ISO calendar year (>0): "
***************
*** 113,122 ****
(week (calendar-read
(format "ISO calendar week (1-%d): " no-weeks)
'(lambda (x) (and (> x 0) (<= x no-weeks)))))
! (day (calendar-read
"ISO day (1-7): "
! '(lambda (x) (and (<= 1 x) (<= x 7))))))
(list (list week day year))))
(calendar-goto-date (calendar-gregorian-from-absolute
(calendar-absolute-from-iso date)))
(or noecho (calendar-print-iso-date)))
--- 112,134 ----
(week (calendar-read
(format "ISO calendar week (1-%d): " no-weeks)
'(lambda (x) (and (> x 0) (<= x no-weeks)))))
! (day (if dayflag (calendar-read
"ISO day (1-7): "
! '(lambda (x) (and (<= 1 x) (<= x 7))))
! 1)))
(list (list week day year))))
+
+ (defun calendar-goto-iso-date (date &optional noecho)
+ "Move cursor to ISO DATE; echo ISO date unless NOECHO is t."
+ (interactive (calendar-iso-read-args t))
+ (calendar-goto-date (calendar-gregorian-from-absolute
+ (calendar-absolute-from-iso date)))
+ (or noecho (calendar-print-iso-date)))
+
+ (defun calendar-goto-iso-week (date &optional noecho)
+ "Move cursor to ISO DATE; echo ISO date unless NOECHO is t.
+ Interactively, goes to the first day of the specified week."
+ (interactive (calendar-iso-read-args))
(calendar-goto-date (calendar-gregorian-from-absolute
(calendar-absolute-from-iso date)))
(or noecho (calendar-print-iso-date)))
^ permalink raw reply [flat|nested] 25+ messages in thread
end of thread, other threads:[~2004-09-28 17:48 UTC | newest]
Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[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 ` calendar-goto-iso-week Emilio Lopes
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
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.