summaryrefslogtreecommitdiff
path: root/lisp/calendar
diff options
context:
space:
mode:
authorGlenn Morris <rgm@gnu.org>2007-07-24 06:12:32 +0000
committerGlenn Morris <rgm@gnu.org>2007-07-24 06:12:32 +0000
commit6ce285a63f3e935a1b8af38c4a003e54b5d607e9 (patch)
treeb026a58cf1c945a88890a7dd0c2a1ec281864b85 /lisp/calendar
parent9e46548e642d529cc76c3cfbfb3c59c20f67d231 (diff)
downloademacs-6ce285a63f3e935a1b8af38c4a003e54b5d607e9.tar.gz
(generate-calendar, (generate-calendar-month): Use dotimes rather than
calendar-for-loop. (calendar-for-loop): Doc fix.
Diffstat (limited to 'lisp/calendar')
-rw-r--r--lisp/calendar/calendar.el28
1 files changed, 15 insertions, 13 deletions
diff --git a/lisp/calendar/calendar.el b/lisp/calendar/calendar.el
index 83ec95c844c..74ee75f295b 100644
--- a/lisp/calendar/calendar.el
+++ b/lisp/calendar/calendar.el
@@ -1343,7 +1343,9 @@ MON defaults to `displayed-month'. YR defaults to `displayed-year'."
(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 @@ Or, for optional MON, YR."
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 @@ line."
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))