changeset 93524:6076b35285b8

(cal-tex-insert-blank-days-at-end, cal-tex-last-blank-p) (cal-tex-daily-page): Expand calendar-for-loops.
author Glenn Morris <rgm@gnu.org>
date Wed, 02 Apr 2008 03:16:47 +0000
parents aa0e26f1d3ae
children 26506821c407
files lisp/calendar/cal-tex.el
diffstat 1 files changed, 32 insertions(+), 29 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/calendar/cal-tex.el	Wed Apr 02 03:15:54 2008 +0000
+++ b/lisp/calendar/cal-tex.el	Wed Apr 02 03:16:47 2008 +0000
@@ -608,10 +608,11 @@
               (mod
                (- (calendar-day-of-week (list month last-day year))
                   calendar-week-start-day)
-               7)))
-        (calendar-for-loop i from (1+ blank-days) to 6 do
-           (if (memq i cal-tex-which-days)
-               (insert (format day-format "" "") "{}{}{}{}%\n"))))))
+               7))
+             (i blank-days))
+        (while (<= (setq i (1+ i)) 6)
+          (if (memq i cal-tex-which-days)
+              (insert (format day-format "" "") "{}{}{}{}%\n"))))))
 
 (defun cal-tex-first-blank-p (month year)
   "Determine if any days of the first week will be printed.
@@ -631,15 +632,16 @@
   "Determine if any days of the last week will be printed.
 Return t if there will there be any days of the last week printed
 in the calendar starting in MONTH YEAR."
-  (let ((last-day (calendar-last-day-of-month month year))
-        any-days the-sunday)          ; the day of week of last Sunday
-    (calendar-for-loop i from (- last-day 6) to last-day do
-       (if (zerop (calendar-day-of-week (list month i year)))
-           (setq the-sunday i)))
-    (calendar-for-loop i from the-sunday to last-day do
-       (if (memq (calendar-day-of-week (list month i year))
-                 cal-tex-which-days)
-           (setq any-days t)))
+  (let* ((last-day (calendar-last-day-of-month month year))
+         (i (- last-day 7))
+         any-days the-sunday)          ; the day of week of last Sunday
+    (while (<= (setq i (1+ i)) last-day)
+      (if (zerop (calendar-day-of-week (list month i year)))
+          (setq the-sunday i)))
+    (setq i (1- the-sunday))
+    (while (<= (setq i (1+ i)) last-day)
+      (if (memq (calendar-day-of-week (list month i year)) cal-tex-which-days)
+          (setq any-days t)))
     any-days))
 
 (defun cal-tex-number-weeks (month year n)
@@ -1396,6 +1398,7 @@
 hourly sections for the period specified by `cal-tex-daily-start'
 and `cal-tex-daily-end'."
   (let ((month-name (cal-tex-month-name (extract-calendar-month date)))
+        (i (1- cal-tex-daily-start))
         hour)
     (cal-tex-banner "cal-tex-daily-page")
     (cal-tex-b-makebox "4cm" "l")
@@ -1417,22 +1420,22 @@
     (cal-tex-hspace ".4cm")
     (cal-tex-rule "0mm" "16.1cm" "1mm")
     (cal-tex-nl ".1cm")
-    (calendar-for-loop i from cal-tex-daily-start to cal-tex-daily-end do
-       (cal-tex-cmd "\\noindent")
-       (setq hour (if cal-tex-24
-                      i
-                    (mod i 12)))
-       (if (zerop hour) (setq hour 12))
-       (cal-tex-b-makebox "1cm" "c")
-       (cal-tex-arg (number-to-string hour))
-       (cal-tex-e-makebox)
-       (cal-tex-rule "0mm" "15.5cm" ".2mm")
-       (cal-tex-nl ".2cm")
-       (cal-tex-b-makebox "1cm" "c")
-       (cal-tex-arg "$\\diamond$" )
-       (cal-tex-e-makebox)
-       (cal-tex-rule "0mm" "15.5cm" ".2mm")
-       (cal-tex-nl ".2cm"))
+    (while (<= (setq i (1+ i)) cal-tex-daily-end)
+      (cal-tex-cmd "\\noindent")
+      (setq hour (if cal-tex-24
+                     i
+                   (mod i 12)))
+      (if (zerop hour) (setq hour 12))
+      (cal-tex-b-makebox "1cm" "c")
+      (cal-tex-arg (number-to-string hour))
+      (cal-tex-e-makebox)
+      (cal-tex-rule "0mm" "15.5cm" ".2mm")
+      (cal-tex-nl ".2cm")
+      (cal-tex-b-makebox "1cm" "c")
+      (cal-tex-arg "$\\diamond$" )
+      (cal-tex-e-makebox)
+      (cal-tex-rule "0mm" "15.5cm" ".2mm")
+      (cal-tex-nl ".2cm"))
     (cal-tex-hfill)
     (insert (cal-tex-mini-calendar
              (extract-calendar-month (cal-tex-previous-month date))