diff options
| author | Glenn Morris | 2012-08-21 00:59:25 -0700 |
|---|---|---|
| committer | Glenn Morris | 2012-08-21 00:59:25 -0700 |
| commit | 9f1ee09efc42e82df21d0697cda35189f0618cd8 (patch) | |
| tree | 237134e3e49ec2b1431dd62055e6dc9c492073aa | |
| parent | a878d0f2c1e1ffd144dbbb455e2bc7fe23845d26 (diff) | |
| download | emacs-9f1ee09efc42e82df21d0697cda35189f0618cd8.tar.gz emacs-9f1ee09efc42e82df21d0697cda35189f0618cd8.zip | |
Remove still more cal-tex code duplication
* lisp/calendar/cal-tex.el (cal-tex-leftday, cal-tex-rightday): New functions.
(cal-tex-cursor-week-at-a-glance, cal-tex-cursor-filofax-2week)
(cal-tex-cursor-filofax-week): Use them.
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/calendar/cal-tex.el | 87 |
2 files changed, 38 insertions, 54 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 87222fa568a..11bdce9a230 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,10 @@ | |||
| 1 | 2012-08-21 Glenn Morris <rgm@gnu.org> | 1 | 2012-08-21 Glenn Morris <rgm@gnu.org> |
| 2 | 2 | ||
| 3 | * calendar/cal-tex.el (cal-tex-leftday, cal-tex-rightday): | ||
| 4 | New functions. | ||
| 5 | (cal-tex-cursor-week-at-a-glance, cal-tex-cursor-filofax-2week) | ||
| 6 | (cal-tex-cursor-filofax-week): Use them. | ||
| 7 | |||
| 3 | * calendar/cal-tex.el (cal-tex-lefthead, cal-tex-righthead): | 8 | * calendar/cal-tex.el (cal-tex-lefthead, cal-tex-righthead): |
| 4 | New constants. | 9 | New constants. |
| 5 | (cal-tex-cursor-week-at-a-glance, cal-tex-cursor-filofax-2week) | 10 | (cal-tex-cursor-week-at-a-glance, cal-tex-cursor-filofax-2week) |
diff --git a/lisp/calendar/cal-tex.el b/lisp/calendar/cal-tex.el index dccb1f1bfc7..1a64edc2071 100644 --- a/lisp/calendar/cal-tex.el +++ b/lisp/calendar/cal-tex.el | |||
| @@ -370,6 +370,28 @@ landscape mode with three rows of four months each." | |||
| 370 | \\footskip 0.125in | 370 | \\footskip 0.125in |
| 371 | "))) | 371 | "))) |
| 372 | 372 | ||
| 373 | (defun cal-tex-leftday (height) | ||
| 374 | "Insert LaTeX code for leftday function." | ||
| 375 | (insert "\\long\\def\\leftday#1#2#3#4#5{% | ||
| 376 | \\rule{\\textwidth}{0.3pt}\\\\% | ||
| 377 | \\hbox to \\textwidth{% | ||
| 378 | \\vbox to " height "{% | ||
| 379 | \\vspace*{2pt}% | ||
| 380 | \\hbox to \\textwidth{\\noindent {\\normalsize \\bf #2} \\small #1 \\hfill #5}% | ||
| 381 | \\hbox to \\textwidth{\\vbox {\\noindent \\footnotesize \\em #4}}% | ||
| 382 | \\hbox to \\textwidth{\\vbox to 0pt {\\noindent \\footnotesize #3}}}}\\\\}\n")) | ||
| 383 | |||
| 384 | (defun cal-tex-rightday (height) | ||
| 385 | "Insert LaTeX code for rightday function." | ||
| 386 | (insert "\\long\\def\\rightday#1#2#3#4#5{% | ||
| 387 | \\rule{\\textwidth}{0.3pt}\\\\% | ||
| 388 | \\hbox to \\textwidth{% | ||
| 389 | \\vbox to " height "{% | ||
| 390 | \\vspace*{2pt}% | ||
| 391 | \\hbox to \\textwidth{\\small #5 \\hfill #1 {\\normalsize \\bf #2}}% | ||
| 392 | \\hbox to \\textwidth{\\vbox {\\raggedleft \\footnotesize \\em #4}}% | ||
| 393 | \\hbox to \\textwidth{\\vbox to 0pt {\\noindent \\footnotesize #3}}}}\\\\}\n")) | ||
| 394 | |||
| 373 | ;;;###cal-autoload | 395 | ;;;###cal-autoload |
| 374 | (defun cal-tex-cursor-filofax-year (&optional n event) | 396 | (defun cal-tex-cursor-filofax-year (&optional n event) |
| 375 | "Make a Filofax one page yearly calendar of year indicated by cursor. | 397 | "Make a Filofax one page yearly calendar of year indicated by cursor. |
| @@ -1060,15 +1082,8 @@ position to use instead of point." | |||
| 1060 | \\footskip .125in | 1082 | \\footskip .125in |
| 1061 | ") | 1083 | ") |
| 1062 | (insert cal-tex-righthead) | 1084 | (insert cal-tex-righthead) |
| 1063 | (insert "\\long\\def\\rightday#1#2#3#4#5{% | 1085 | (cal-tex-rightday "2.75in") |
| 1064 | \\rule{\\textwidth}{0.3pt}\\\\% | 1086 | ;; FIXME this is just (cal-tex-rightday "1.8in"). |
| 1065 | \\hbox to \\textwidth{% | ||
| 1066 | \\vbox to 2.75in{% | ||
| 1067 | \\vspace*{2pt}% | ||
| 1068 | \\hbox to \\textwidth{\\small #5 \\hfill #1 {\\normalsize \\bf #2}}% | ||
| 1069 | \\hbox to \\textwidth{\\vbox {\\raggedleft \\footnotesize \\em #4}}% | ||
| 1070 | \\hbox to \\textwidth{\\vbox to 0pt {\\noindent \\footnotesize #3}}}}\\\\} | ||
| 1071 | ") | ||
| 1072 | (insert "\\long\\def\\weekend#1#2#3#4#5{% | 1087 | (insert "\\long\\def\\weekend#1#2#3#4#5{% |
| 1073 | \\rule{\\textwidth}{0.3pt}\\\\% | 1088 | \\rule{\\textwidth}{0.3pt}\\\\% |
| 1074 | \\hbox to \\textwidth{% | 1089 | \\hbox to \\textwidth{% |
| @@ -1079,15 +1094,7 @@ position to use instead of point." | |||
| 1079 | \\hbox to \\textwidth{\\vbox to 0pt {\\noindent \\footnotesize #3}}}}\\\\} | 1094 | \\hbox to \\textwidth{\\vbox to 0pt {\\noindent \\footnotesize #3}}}}\\\\} |
| 1080 | ") | 1095 | ") |
| 1081 | (insert cal-tex-lefthead) | 1096 | (insert cal-tex-lefthead) |
| 1082 | (insert "\\long\\def\\leftday#1#2#3#4#5{% | 1097 | (cal-tex-leftday "2.75in") |
| 1083 | \\rule{\\textwidth}{0.3pt}\\\\% | ||
| 1084 | \\hbox to \\textwidth{% | ||
| 1085 | \\vbox to 2.75in{% | ||
| 1086 | \\vspace*{2pt}% | ||
| 1087 | \\hbox to \\textwidth{\\noindent {\\normalsize \\bf #2} \\small #1 \\hfill #5}% | ||
| 1088 | \\hbox to \\textwidth{\\vbox {\\noindent \\footnotesize \\em #4}}% | ||
| 1089 | \\hbox to \\textwidth{\\vbox to 0pt {\\noindent \\footnotesize #3}}}}\\\\} | ||
| 1090 | ") | ||
| 1091 | (cal-tex-b-document) | 1098 | (cal-tex-b-document) |
| 1092 | (cal-tex-cmd "\\pagestyle" "empty") | 1099 | (cal-tex-cmd "\\pagestyle" "empty") |
| 1093 | (dotimes (i n) | 1100 | (dotimes (i n) |
| @@ -1215,25 +1222,9 @@ Optional EVENT indicates a buffer position to use instead of point." | |||
| 1215 | (cal-tex-preamble "twoside") | 1222 | (cal-tex-preamble "twoside") |
| 1216 | (cal-tex-filofax-paper) | 1223 | (cal-tex-filofax-paper) |
| 1217 | (insert cal-tex-righthead) | 1224 | (insert cal-tex-righthead) |
| 1218 | (insert "\\long\\def\\rightday#1#2#3#4#5{% | 1225 | (cal-tex-rightday "0.7in") |
| 1219 | \\rule{\\textwidth}{0.3pt}\\\\% | ||
| 1220 | \\hbox to \\textwidth{% | ||
| 1221 | \\vbox to 0.7in{% | ||
| 1222 | \\vspace*{2pt}% | ||
| 1223 | \\hbox to \\textwidth{\\small #5 \\hfill #1 {\\normalsize \\bf #2}}% | ||
| 1224 | \\hbox to \\textwidth{\\vbox {\\raggedleft \\footnotesize \\em #4}}% | ||
| 1225 | \\hbox to \\textwidth{\\vbox to 0pt {\\noindent \\footnotesize #3}}}}\\\\} | ||
| 1226 | ") | ||
| 1227 | (insert cal-tex-lefthead) | 1226 | (insert cal-tex-lefthead) |
| 1228 | (insert "\\long\\def\\leftday#1#2#3#4#5{% | 1227 | (cal-tex-leftday "0.7in") |
| 1229 | \\rule{\\textwidth}{0.3pt}\\\\% | ||
| 1230 | \\hbox to \\textwidth{% | ||
| 1231 | \\vbox to 0.7in{% | ||
| 1232 | \\vspace*{2pt}% | ||
| 1233 | \\hbox to \\textwidth{\\noindent {\\normalsize \\bf #2} \\small #1 \\hfill #5}% | ||
| 1234 | \\hbox to \\textwidth{\\vbox {\\noindent \\footnotesize \\em #4}}% | ||
| 1235 | \\hbox to \\textwidth{\\vbox to 0pt {\\noindent \\footnotesize #3}}}}\\\\} | ||
| 1236 | ") | ||
| 1237 | (cal-tex-b-document) | 1228 | (cal-tex-b-document) |
| 1238 | (cal-tex-cmd "\\pagestyle" "empty") | 1229 | (cal-tex-cmd "\\pagestyle" "empty") |
| 1239 | (dotimes (i n) | 1230 | (dotimes (i n) |
| @@ -1303,15 +1294,8 @@ Optional EVENT indicates a buffer position to use instead of point." | |||
| 1303 | (cal-tex-preamble "twoside") | 1294 | (cal-tex-preamble "twoside") |
| 1304 | (cal-tex-filofax-paper) | 1295 | (cal-tex-filofax-paper) |
| 1305 | (insert cal-tex-righthead) | 1296 | (insert cal-tex-righthead) |
| 1306 | (insert "\\long\\def\\rightday#1#2#3#4#5{% | 1297 | (cal-tex-rightday "1.85in") |
| 1307 | \\rule{\\textwidth}{0.3pt}\\\\% | 1298 | ;; FIXME this is just (cal-tex-rightday "0.8in"). |
| 1308 | \\hbox to \\textwidth{% | ||
| 1309 | \\vbox to 1.85in{% | ||
| 1310 | \\vspace*{2pt}% | ||
| 1311 | \\hbox to \\textwidth{\\small #5 \\hfill #1 {\\normalsize \\bf #2}}% | ||
| 1312 | \\hbox to \\textwidth{\\vbox {\\raggedleft \\footnotesize \\em #4}}% | ||
| 1313 | \\hbox to \\textwidth{\\vbox to 0pt {\\noindent \\footnotesize #3}}}}\\\\} | ||
| 1314 | ") | ||
| 1315 | (insert "\\long\\def\\weekend#1#2#3#4#5{% | 1299 | (insert "\\long\\def\\weekend#1#2#3#4#5{% |
| 1316 | \\rule{\\textwidth}{0.3pt}\\\\% | 1300 | \\rule{\\textwidth}{0.3pt}\\\\% |
| 1317 | \\hbox to \\textwidth{% | 1301 | \\hbox to \\textwidth{% |
| @@ -1322,15 +1306,7 @@ Optional EVENT indicates a buffer position to use instead of point." | |||
| 1322 | \\hbox to \\textwidth{\\vbox to 0pt {\\noindent \\footnotesize #3}}}}\\\\} | 1306 | \\hbox to \\textwidth{\\vbox to 0pt {\\noindent \\footnotesize #3}}}}\\\\} |
| 1323 | ") | 1307 | ") |
| 1324 | (insert cal-tex-lefthead) | 1308 | (insert cal-tex-lefthead) |
| 1325 | (insert "\\long\\def\\leftday#1#2#3#4#5{% | 1309 | (cal-tex-leftday "1.85in") |
| 1326 | \\rule{\\textwidth}{0.3pt}\\\\% | ||
| 1327 | \\hbox to \\textwidth{% | ||
| 1328 | \\vbox to 1.85in{% | ||
| 1329 | \\vspace*{2pt}% | ||
| 1330 | \\hbox to \\textwidth{\\noindent {\\normalsize \\bf #2} \\small #1 \\hfill #5}% | ||
| 1331 | \\hbox to \\textwidth{\\vbox {\\noindent \\footnotesize \\em #4}}% | ||
| 1332 | \\hbox to \\textwidth{\\vbox to 0pt {\\noindent \\footnotesize #3}}}}\\\\} | ||
| 1333 | ") | ||
| 1334 | (cal-tex-b-document) | 1310 | (cal-tex-b-document) |
| 1335 | (cal-tex-cmd "\\pagestyle" "empty") | 1311 | (cal-tex-cmd "\\pagestyle" "empty") |
| 1336 | (dotimes (i n) | 1312 | (dotimes (i n) |
| @@ -1437,6 +1413,7 @@ Optional EVENT indicates a buffer position to use instead of point." | |||
| 1437 | (cal-tex-preamble "twoside") | 1413 | (cal-tex-preamble "twoside") |
| 1438 | (cal-tex-filofax-paper) | 1414 | (cal-tex-filofax-paper) |
| 1439 | (insert cal-tex-righthead) | 1415 | (insert cal-tex-righthead) |
| 1416 | ;; Not quite cal-tex-rightday. | ||
| 1440 | (insert "\\long\\def\\rightday#1#2#3{% | 1417 | (insert "\\long\\def\\rightday#1#2#3{% |
| 1441 | \\rule{\\textwidth}{0.3pt}\\\\% | 1418 | \\rule{\\textwidth}{0.3pt}\\\\% |
| 1442 | \\hbox to \\textwidth{% | 1419 | \\hbox to \\textwidth{% |
| @@ -1446,6 +1423,7 @@ Optional EVENT indicates a buffer position to use instead of point." | |||
| 1446 | \\hbox to \\textwidth{\\vbox {\\raggedleft \\em #2}}% | 1423 | \\hbox to \\textwidth{\\vbox {\\raggedleft \\em #2}}% |
| 1447 | \\hbox to \\textwidth{\\vbox {\\noindent \\footnotesize #1}}}}} | 1424 | \\hbox to \\textwidth{\\vbox {\\noindent \\footnotesize #1}}}}} |
| 1448 | ") | 1425 | ") |
| 1426 | ;; FIXME this is just \rightday from above. | ||
| 1449 | (insert "\\long\\def\\weekend#1#2#3{% | 1427 | (insert "\\long\\def\\weekend#1#2#3{% |
| 1450 | \\rule{\\textwidth}{0.3pt}\\\\% | 1428 | \\rule{\\textwidth}{0.3pt}\\\\% |
| 1451 | \\hbox to \\textwidth{% | 1429 | \\hbox to \\textwidth{% |
| @@ -1456,6 +1434,7 @@ Optional EVENT indicates a buffer position to use instead of point." | |||
| 1456 | \\hbox to \\textwidth{\\vbox {\\noindent \\footnotesize #1}}}}} | 1434 | \\hbox to \\textwidth{\\vbox {\\noindent \\footnotesize #1}}}}} |
| 1457 | ") | 1435 | ") |
| 1458 | (insert cal-tex-lefthead) | 1436 | (insert cal-tex-lefthead) |
| 1437 | ;; Not quite cal-tex-leftday. | ||
| 1459 | (insert "\\long\\def\\leftday#1#2#3{% | 1438 | (insert "\\long\\def\\leftday#1#2#3{% |
| 1460 | \\rule{\\textwidth}{0.3pt}\\\\% | 1439 | \\rule{\\textwidth}{0.3pt}\\\\% |
| 1461 | \\hbox to \\textwidth{% | 1440 | \\hbox to \\textwidth{% |