aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2012-08-20 22:29:25 -0400
committerGlenn Morris2012-08-20 22:29:25 -0400
commitc68cd5d433e1bbb4478dca51ef5c7ec53259e77e (patch)
tree43ee1bdb6cce65364ab7313fd2eb0b2cc2ba6922
parent9dca480127a5642b94b2736b855099cf302c90d4 (diff)
downloademacs-c68cd5d433e1bbb4478dca51ef5c7ec53259e77e.tar.gz
emacs-c68cd5d433e1bbb4478dca51ef5c7ec53259e77e.zip
Reduce some cal-tex code duplication
* lisp/calendar/cal-tex.el (cal-tex-filofax-paper): New function. (cal-tex-cursor-filofax-year, cal-tex-cursor-filofax-2week) (cal-tex-cursor-filofax-week, cal-tex-cursor-filofax-daily): Use it. (cal-tex-weekly-paper): New function. (cal-tex-cursor-week, cal-tex-cursor-week2) (cal-tex-cursor-week-iso, cal-tex-cursor-week-monday) (cal-tex-cursor-day): Use it.
-rw-r--r--lisp/ChangeLog8
-rw-r--r--lisp/calendar/cal-tex.el85
2 files changed, 45 insertions, 48 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 3e68ed43b80..5f98620084c 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,13 @@
12012-08-21 Glenn Morris <rgm@gnu.org> 12012-08-21 Glenn Morris <rgm@gnu.org>
2 2
3 * calendar/cal-tex.el (cal-tex-filofax-paper): New function.
4 (cal-tex-cursor-filofax-year, cal-tex-cursor-filofax-2week)
5 (cal-tex-cursor-filofax-week, cal-tex-cursor-filofax-daily): Use it.
6 (cal-tex-weekly-paper): New function.
7 (cal-tex-cursor-week, cal-tex-cursor-week2)
8 (cal-tex-cursor-week-iso, cal-tex-cursor-week-monday)
9 (cal-tex-cursor-day): Use it.
10
3 * calendar/cal-tex.el (cal-tex-cursor-week-at-a-glance) 11 * calendar/cal-tex.el (cal-tex-cursor-week-at-a-glance)
4 (cal-tex-cursor-filofax-week): Remove leading blank page. 12 (cal-tex-cursor-filofax-week): Remove leading blank page.
5 13
diff --git a/lisp/calendar/cal-tex.el b/lisp/calendar/cal-tex.el
index 8868c2495f9..fc813040537 100644
--- a/lisp/calendar/cal-tex.el
+++ b/lisp/calendar/cal-tex.el
@@ -344,6 +344,25 @@ landscape mode with three rows of four months each."
344 (run-hooks 'cal-tex-year-hook)) 344 (run-hooks 'cal-tex-year-hook))
345 (run-hooks 'cal-tex-hook)) 345 (run-hooks 'cal-tex-hook))
346 346
347
348(defun cal-tex-filofax-paper (&optional year)
349 "Insert some page size settings for filofax layouts."
350 (insert "\\textwidth 3.25in
351\\textheight 6.5in
352\\headheight -0.875in
353\\topmargin 0pt
354")
355 (insert
356 ;; Why is this one subtly different? Who knows...
357 (if year "\\oddsidemargin 1.675in
358\\evensidemargin 1.675in
359"
360 "\\oddsidemargin 1.75in
361\\evensidemargin 1.5in
362\\headsep 0.125in
363\\footskip 0.125in
364")))
365
347;;;###cal-autoload 366;;;###cal-autoload
348(defun cal-tex-cursor-filofax-year (&optional n event) 367(defun cal-tex-cursor-filofax-year (&optional n event)
349 "Make a Filofax one page yearly calendar of year indicated by cursor. 368 "Make a Filofax one page yearly calendar of year indicated by cursor.
@@ -354,12 +373,7 @@ Optional EVENT indicates a buffer position to use instead of point."
354 (or n (setq n 1)) 373 (or n (setq n 1))
355 (let ((year (calendar-extract-year (calendar-cursor-to-date t event)))) 374 (let ((year (calendar-extract-year (calendar-cursor-to-date t event))))
356 (cal-tex-preamble "twoside") 375 (cal-tex-preamble "twoside")
357 (cal-tex-cmd "\\textwidth 3.25in") 376 (cal-tex-filofax-paper 'year)
358 (cal-tex-cmd "\\textheight 6.5in")
359 (cal-tex-cmd "\\oddsidemargin 1.675in")
360 (cal-tex-cmd "\\evensidemargin 1.675in")
361 (cal-tex-cmd "\\topmargin 0pt")
362 (cal-tex-cmd "\\headheight -0.875in")
363 (cal-tex-cmd "\\fboxsep 0.5mm") 377 (cal-tex-cmd "\\fboxsep 0.5mm")
364 (cal-tex-cmd "\\pagestyle{empty}") 378 (cal-tex-cmd "\\pagestyle{empty}")
365 (cal-tex-b-document) 379 (cal-tex-b-document)
@@ -653,6 +667,15 @@ this is only an upper bound."
653{\\makebox[2em]{\\rule{0cm}{#2ex}#1}\\rule{3in}{.15mm}}\n" 667{\\makebox[2em]{\\rule{0cm}{#2ex}#1}\\rule{3in}{.15mm}}\n"
654 "One hour and a line on the right.") 668 "One hour and a line on the right.")
655 669
670(defun cal-tex-weekly-paper (&optional nomargins)
671 "Insert some page size settings for weekly layouts."
672 (insert "\\textwidth 6.5in
673\\textheight 10.5in
674")
675 (or nomargins (insert "\\oddsidemargin 0in
676\\evensidemargin 0in
677")))
678
656;; TODO cal-tex-diary-support. 679;; TODO cal-tex-diary-support.
657;; TODO respect cal-tex-daily-start,end (see cal-tex-week-hours). 680;; TODO respect cal-tex-daily-start,end (see cal-tex-week-hours).
658;;;###cal-autoload 681;;;###cal-autoload
@@ -677,10 +700,7 @@ entries are not shown). The calendar shows the hours 8-12am, 1-5pm."
677 (holidays (if cal-tex-holidays 700 (holidays (if cal-tex-holidays
678 (holiday-in-range d1 d2)))) 701 (holiday-in-range d1 d2))))
679 (cal-tex-preamble "11pt") 702 (cal-tex-preamble "11pt")
680 (cal-tex-cmd "\\textwidth 6.5in") 703 (cal-tex-weekly-paper)
681 (cal-tex-cmd "\\textheight 10.5in")
682 (cal-tex-cmd "\\oddsidemargin 0in")
683 (cal-tex-cmd "\\evensidemargin 0in")
684 (insert cal-tex-LaTeX-hourbox) 704 (insert cal-tex-LaTeX-hourbox)
685 (cal-tex-b-document) 705 (cal-tex-b-document)
686 (cal-tex-cmd "\\pagestyle{empty}") 706 (cal-tex-cmd "\\pagestyle{empty}")
@@ -732,10 +752,7 @@ Optional EVENT indicates a buffer position to use instead of point."
732 (holidays (if cal-tex-holidays 752 (holidays (if cal-tex-holidays
733 (holiday-in-range d1 d2)))) 753 (holiday-in-range d1 d2))))
734 (cal-tex-preamble "12pt") 754 (cal-tex-preamble "12pt")
735 (cal-tex-cmd "\\textwidth 6.5in") 755 (cal-tex-weekly-paper)
736 (cal-tex-cmd "\\textheight 10.5in")
737 (cal-tex-cmd "\\oddsidemargin 0in")
738 (cal-tex-cmd "\\evensidemargin 0in")
739 (insert cal-tex-LaTeX-hourbox) 756 (insert cal-tex-LaTeX-hourbox)
740 (cal-tex-b-document) 757 (cal-tex-b-document)
741 (cal-tex-cmd "\\pagestyle{empty}") 758 (cal-tex-cmd "\\pagestyle{empty}")
@@ -819,10 +836,7 @@ position to use instead of point."
819 (cal-tex-list-diary-entries d1 d2))) 836 (cal-tex-list-diary-entries d1 d2)))
820 s) 837 s)
821 (cal-tex-preamble "11pt") 838 (cal-tex-preamble "11pt")
822 (cal-tex-cmd "\\textwidth 6.5in") 839 (cal-tex-weekly-paper)
823 (cal-tex-cmd "\\textheight 10.5in")
824 (cal-tex-cmd "\\oddsidemargin 0in")
825 (cal-tex-cmd "\\evensidemargin 0in")
826 (cal-tex-b-document) 840 (cal-tex-b-document)
827 (cal-tex-cmd "\\pagestyle{empty}") 841 (cal-tex-cmd "\\pagestyle{empty}")
828 (dotimes (i n) 842 (dotimes (i n)
@@ -941,10 +955,7 @@ to use instead of point."
941 (calendar-absolute-from-gregorian 955 (calendar-absolute-from-gregorian
942 (calendar-cursor-to-date t event)))))) 956 (calendar-cursor-to-date t event))))))
943 (cal-tex-preamble "11pt") 957 (cal-tex-preamble "11pt")
944 (cal-tex-cmd "\\textwidth 6.5in") 958 (cal-tex-weekly-paper)
945 (cal-tex-cmd "\\textheight 10.5in")
946 (cal-tex-cmd "\\oddsidemargin 0in")
947 (cal-tex-cmd "\\evensidemargin 0in")
948 (cal-tex-b-document) 959 (cal-tex-b-document)
949 (dotimes (i n) 960 (dotimes (i n)
950 (cal-tex-vspace "-1cm") 961 (cal-tex-vspace "-1cm")
@@ -1192,14 +1203,7 @@ Optional EVENT indicates a buffer position to use instead of point."
1192 (diary-list (if cal-tex-diary 1203 (diary-list (if cal-tex-diary
1193 (cal-tex-list-diary-entries d1 d2)))) 1204 (cal-tex-list-diary-entries d1 d2))))
1194 (cal-tex-preamble "twoside") 1205 (cal-tex-preamble "twoside")
1195 (cal-tex-cmd "\\textwidth 3.25in") 1206 (cal-tex-filofax-paper)
1196 (cal-tex-cmd "\\textheight 6.5in")
1197 (cal-tex-cmd "\\oddsidemargin 1.75in")
1198 (cal-tex-cmd "\\evensidemargin 1.5in")
1199 (cal-tex-cmd "\\topmargin 0pt")
1200 (cal-tex-cmd "\\headheight -0.875in")
1201 (cal-tex-cmd "\\headsep 0.125in")
1202 (cal-tex-cmd "\\footskip .125in")
1203 (insert "\\def\\righthead#1{\\hfill {\\normalsize \\bf #1}\\\\[-6pt]} 1207 (insert "\\def\\righthead#1{\\hfill {\\normalsize \\bf #1}\\\\[-6pt]}
1204\\long\\def\\rightday#1#2#3#4#5{% 1208\\long\\def\\rightday#1#2#3#4#5{%
1205 \\rule{\\textwidth}{0.3pt}\\\\% 1209 \\rule{\\textwidth}{0.3pt}\\\\%
@@ -1286,14 +1290,7 @@ Optional EVENT indicates a buffer position to use instead of point."
1286 (diary-list (if cal-tex-diary 1290 (diary-list (if cal-tex-diary
1287 (cal-tex-list-diary-entries d1 d2)))) 1291 (cal-tex-list-diary-entries d1 d2))))
1288 (cal-tex-preamble "twoside") 1292 (cal-tex-preamble "twoside")
1289 (cal-tex-cmd "\\textwidth 3.25in") 1293 (cal-tex-filofax-paper)
1290 (cal-tex-cmd "\\textheight 6.5in")
1291 (cal-tex-cmd "\\oddsidemargin 1.75in")
1292 (cal-tex-cmd "\\evensidemargin 1.5in")
1293 (cal-tex-cmd "\\topmargin 0pt")
1294 (cal-tex-cmd "\\headheight -0.875in")
1295 (cal-tex-cmd "\\headsep 0.125in")
1296 (cal-tex-cmd "\\footskip .125in")
1297 (insert "\\def\\righthead#1{\\hfill {\\normalsize \\bf #1}\\\\[-6pt]} 1294 (insert "\\def\\righthead#1{\\hfill {\\normalsize \\bf #1}\\\\[-6pt]}
1298\\long\\def\\rightday#1#2#3#4#5{% 1295\\long\\def\\rightday#1#2#3#4#5{%
1299 \\rule{\\textwidth}{0.3pt}\\\\% 1296 \\rule{\\textwidth}{0.3pt}\\\\%
@@ -1425,14 +1422,7 @@ Optional EVENT indicates a buffer position to use instead of point."
1425 (diary-list (if cal-tex-diary 1422 (diary-list (if cal-tex-diary
1426 (cal-tex-list-diary-entries d1 d2)))) 1423 (cal-tex-list-diary-entries d1 d2))))
1427 (cal-tex-preamble "twoside") 1424 (cal-tex-preamble "twoside")
1428 (cal-tex-cmd "\\textwidth 3.25in") 1425 (cal-tex-filofax-paper)
1429 (cal-tex-cmd "\\textheight 6.5in")
1430 (cal-tex-cmd "\\oddsidemargin 1.75in")
1431 (cal-tex-cmd "\\evensidemargin 1.5in")
1432 (cal-tex-cmd "\\topmargin 0pt")
1433 (cal-tex-cmd "\\headheight -0.875in")
1434 (cal-tex-cmd "\\headsep 0.125in")
1435 (cal-tex-cmd "\\footskip .125in")
1436 (insert "\\def\\righthead#1{\\hfill {\\normalsize \\bf #1}\\\\[-6pt]} 1426 (insert "\\def\\righthead#1{\\hfill {\\normalsize \\bf #1}\\\\[-6pt]}
1437\\long\\def\\rightday#1#2#3{% 1427\\long\\def\\rightday#1#2#3{%
1438 \\rule{\\textwidth}{0.3pt}\\\\% 1428 \\rule{\\textwidth}{0.3pt}\\\\%
@@ -1525,8 +1515,7 @@ a buffer position to use instead of point."
1525 (let ((date (calendar-absolute-from-gregorian 1515 (let ((date (calendar-absolute-from-gregorian
1526 (calendar-cursor-to-date t event)))) 1516 (calendar-cursor-to-date t event))))
1527 (cal-tex-preamble "12pt") 1517 (cal-tex-preamble "12pt")
1528 (cal-tex-cmd "\\textwidth 6.5in") 1518 (cal-tex-weekly-paper 'nomargins)
1529 (cal-tex-cmd "\\textheight 10.5in")
1530 (cal-tex-b-document) 1519 (cal-tex-b-document)
1531 (cal-tex-cmd "\\pagestyle{empty}") 1520 (cal-tex-cmd "\\pagestyle{empty}")
1532 (dotimes (i n) 1521 (dotimes (i n)