]> git.eshelyaron.com Git - emacs.git/commitdiff
Revert accidental deletion from previous change
authorGlenn Morris <rgm@gnu.org>
Tue, 21 Aug 2012 19:18:56 +0000 (15:18 -0400)
committerGlenn Morris <rgm@gnu.org>
Tue, 21 Aug 2012 19:18:56 +0000 (15:18 -0400)
lisp/calendar/cal-tex.el

index b5c92a3b0e8891352075d5bfc44ee57733636596..5891693282fe001cca83c62dc76d8172059a0eed 100644 (file)
@@ -1214,6 +1214,78 @@ position to use instead of point."
                      last-nonmenu-event))
   (cal-tex-weekly-common n event))
 
+;;;###cal-autoload
+(defun cal-tex-cursor-filofax-2week (&optional n event)
+  "Two-weeks-at-a-glance Filofax style calendar for week cursor is in.
+Optional prefix argument N specifies number of weeks (default 1).
+The calendar shows holiday and diary entries if
+`cal-tex-holidays' and `cal-tex-diary', respectively, are non-nil.
+Optional EVENT indicates a buffer position to use instead of point."
+  (interactive (list (prefix-numeric-value current-prefix-arg)
+                     last-nonmenu-event))
+  (or n (setq n 1))
+  (let* ((date (calendar-gregorian-from-absolute
+                (calendar-dayname-on-or-before
+                 calendar-week-start-day
+                 (calendar-absolute-from-gregorian
+                  (calendar-cursor-to-date t event)))))
+         (month (calendar-extract-month date))
+         (year (calendar-extract-year date))
+         (day (calendar-extract-day date))
+         (d1 (calendar-absolute-from-gregorian date))
+         (d2 (+ (* 7 n) d1))
+         (holidays (if cal-tex-holidays
+                       (holiday-in-range d1 d2)))
+         (diary-list (if cal-tex-diary
+                         (cal-tex-list-diary-entries d1 d2))))
+    (cal-tex-preamble "twoside")
+    (cal-tex-filofax-paper)
+    (insert cal-tex-righthead)
+    (cal-tex-rightday "0.7in")
+    (insert cal-tex-lefthead)
+    (cal-tex-leftday "0.7in")
+    (cal-tex-b-document)
+    (cal-tex-cmd "\\pagestyle" "empty")
+    (dotimes (i n)
+      (if (zerop (mod i 2))
+          (insert "\\righthead")
+        (insert "\\lefthead"))
+      (cal-tex-arg
+       (let ((d (cal-tex-incr-date date 6)))
+         (if (= (calendar-extract-month date)
+                (calendar-extract-month d))
+             (format "%s %s"
+                     (cal-tex-month-name (calendar-extract-month date))
+                     (calendar-extract-year date))
+           (if (= (calendar-extract-year date)
+                  (calendar-extract-year d))
+               (format "%s---%s %s"
+                       (cal-tex-month-name (calendar-extract-month date))
+                       (cal-tex-month-name (calendar-extract-month d))
+                       (calendar-extract-year date))
+              (format "%s %s---%s %s"
+                      (cal-tex-month-name (calendar-extract-month date))
+                      (calendar-extract-year date)
+                      (cal-tex-month-name (calendar-extract-month d))
+                      (calendar-extract-year d))))))
+      (insert "%\n")
+      (dotimes (_jdummy 7)
+        (if (zerop (mod i 2))
+            (insert "\\rightday")
+          (insert "\\leftday"))
+        (cal-tex-arg (cal-tex-LaTeXify-string (calendar-day-name date)))
+        (cal-tex-arg (number-to-string (calendar-extract-day date)))
+        (cal-tex-arg (cal-tex-latexify-list diary-list date))
+        (cal-tex-arg (cal-tex-latexify-list holidays date))
+        (cal-tex-arg (eval cal-tex-daily-string))
+        (insert "%\n")
+        (setq date (cal-tex-incr-date date)))
+      (unless (= i (1- n))
+        (run-hooks 'cal-tex-week-hook)
+        (cal-tex-newpage)))
+    (cal-tex-end-document)
+    (run-hooks 'cal-tex-hook)))
+
 ;;;###cal-autoload
 (defun cal-tex-cursor-filofax-week (&optional n event)
   "One-week-at-a-glance Filofax style calendar for week indicated by cursor.
@@ -1223,7 +1295,88 @@ if `cal-tex-holidays' and `cal-tex-diary', respectively, are non-nil.
 Optional EVENT indicates a buffer position to use instead of point."
   (interactive (list (prefix-numeric-value current-prefix-arg)
                      last-nonmenu-event))
-  (cal-tex-weekly-common n event t))
+   (cal-tex-weekly-common n event t))
+
+;;;###cal-autoload
+(defun cal-tex-cursor-filofax-daily (&optional n event)
+  "Day-per-page Filofax style calendar for week indicated by cursor.
+Optional prefix argument N specifies number of weeks (default 1),
+starting on Mondays.  The calendar shows holiday and diary
+entries if `cal-tex-holidays' and `cal-tex-diary', respectively,
+are non-nil.  Pages are ruled if `cal-tex-rules' is non-nil.
+Optional EVENT indicates a buffer position to use instead of point."
+  (interactive (list (prefix-numeric-value current-prefix-arg)
+                     last-nonmenu-event))
+  (or n (setq n 1))
+  (let* ((date (calendar-gregorian-from-absolute
+                (calendar-dayname-on-or-before
+                 1
+                 (calendar-absolute-from-gregorian
+                  (calendar-cursor-to-date t event)))))
+         (month (calendar-extract-month date))
+         (year (calendar-extract-year date))
+         (day (calendar-extract-day date))
+         (d1 (calendar-absolute-from-gregorian date))
+         (d2 (+ (* 7 n) d1))
+         (holidays (if cal-tex-holidays
+                       (holiday-in-range d1 d2)))
+         (diary-list (if cal-tex-diary
+                         (cal-tex-list-diary-entries d1 d2))))
+    (cal-tex-preamble "twoside")
+    (cal-tex-filofax-paper)
+    (insert cal-tex-righthead)
+    (cal-tex-shortday "rightday")
+    (cal-tex-shortday "weekend")
+    (insert cal-tex-lefthead)
+    (cal-tex-shortday "leftday")
+    (insert "\\newbox\\LineBox
+\\setbox\\LineBox=\\hbox to\\textwidth{%
+\\vrule height.2in width0pt\\leaders\\hrule\\hfill}
+\\def\\linesfill{\\par\\leaders\\copy\\LineBox\\vfill}
+")
+    (cal-tex-b-document)
+    (cal-tex-cmd "\\pagestyle" "empty")
+    (dotimes (i n)
+      (dotimes (j 4)
+        (let ((even (zerop (% j 2))))
+          (insert (if even
+                      "\\righthead"
+                    "\\lefthead"))
+          (cal-tex-arg (calendar-date-string date))
+          (insert "%\n")
+          (insert (if even
+                      "\\rightday"
+                    "\\leftday")))
+        (cal-tex-arg (cal-tex-latexify-list diary-list date))
+        (cal-tex-arg (cal-tex-latexify-list holidays date "\\\\" t))
+        (cal-tex-arg (eval cal-tex-daily-string))
+        (insert "%\n")
+        (if cal-tex-rules
+            (insert "\\linesfill\n")
+          (insert "\\vfill\\noindent\\rule{\\textwidth}{0.3pt}\\\\%\n"))
+        (cal-tex-newpage)
+        (setq date (cal-tex-incr-date date)))
+      (insert "%\n")
+      (dotimes (_jdummy 2)
+        (insert "\\lefthead")
+        (cal-tex-arg (calendar-date-string date))
+        (insert "\\weekend")
+        (cal-tex-arg (cal-tex-latexify-list diary-list date))
+        (cal-tex-arg (cal-tex-latexify-list holidays date "\\\\" t))
+        (cal-tex-arg (eval cal-tex-daily-string))
+        (insert "%\n")
+        (if cal-tex-rules
+            (insert "\\linesfill\n")
+          (insert "\\vfill"))
+        (setq date (cal-tex-incr-date date)))
+      (or cal-tex-rules
+          (insert "\\noindent\\rule{\\textwidth}{0.3pt}\\\\%\n"))
+      (unless (= i (1- n))
+        (run-hooks 'cal-tex-week-hook)
+        (cal-tex-newpage)))
+    (cal-tex-end-document)
+    (run-hooks 'cal-tex-hook)))
+
 
 ;;;
 ;;;  Daily calendars