# HG changeset patch # User Glenn Morris # Date 1185257535 0 # Node ID 1ee19eca3bfcab13b63df769c79af6fff4dd158c # Parent 85f6cb7c9558deb1fcaa268493f86e2e97a2a5bf (generate-calendar, (generate-calendar-month): Use dotimes rather than calendar-for-loop. (calendar-for-loop): Doc fix. diff -r 85f6cb7c9558 -r 1ee19eca3bfc lisp/calendar/calendar.el --- a/lisp/calendar/calendar.el Tue Jul 24 06:11:37 2007 +0000 +++ b/lisp/calendar/calendar.el Tue Jul 24 06:12:15 2007 +0000 @@ -1343,7 +1343,9 @@ (cons mon yr)) (defmacro calendar-for-loop (var from init to final do &rest body) - "Execute a for loop." + "Execute a for loop. +Evaluate BODY with VAR bound to successive integers from INIT to FINAL, +inclusive." (declare (debug (symbolp "from" form "to" form "do" body))) `(let ((,var (1- ,init))) (while (>= ,final (setq ,var (1+ ,var))) @@ -2110,9 +2112,9 @@ displayed-year year) (erase-buffer) (increment-calendar-month month year -1) - (calendar-for-loop i from 0 to 2 do - (generate-calendar-month month year (+ 5 (* 25 i))) - (increment-calendar-month month year 1))) + (dotimes (i 3) + (generate-calendar-month month year (+ 5 (* 25 i))) + (increment-calendar-month month year 1))) (defun generate-calendar-month (month year indent) "Produce a calendar for MONTH, YEAR on the Gregorian calendar. @@ -2133,18 +2135,18 @@ indent t) (calendar-insert-indented "" indent);; Go to proper spot ;; Use the first two characters of each day to head the columns. - (calendar-for-loop i from 0 to 6 do - (insert - (let ((string - (calendar-day-name (mod (+ calendar-week-start-day i) 7) nil t))) - (if enable-multibyte-characters - (truncate-string-to-width string 2) - (substring string 0 2))) - " ")) + (dotimes (i 7) + (insert + (let ((string + (calendar-day-name (mod (+ calendar-week-start-day i) 7) nil t))) + (if enable-multibyte-characters + (truncate-string-to-width string 2) + (substring string 0 2))) + " ")) (calendar-insert-indented "" 0 t);; Force onto following line (calendar-insert-indented "" indent);; Go to proper spot ;; Add blank days before the first of the month - (calendar-for-loop i from 1 to blank-days do (insert " ")) + (dotimes (idummy blank-days) (insert " ")) ;; Put in the days of the month (calendar-for-loop i from 1 to last do (insert (format "%2d " i))