diff options
| author | Glenn Morris | 2012-08-21 14:15:56 -0400 |
|---|---|---|
| committer | Glenn Morris | 2012-08-21 14:15:56 -0400 |
| commit | 52f56d5a54184b4e9c5147d06ec3911bf559c9b4 (patch) | |
| tree | f03fa9b485d84988e3c5584cf0fb6663ce6d90da | |
| parent | 1b9d9d1659f819252abb4d8f49e5fd0f7bb56efd (diff) | |
| download | emacs-52f56d5a54184b4e9c5147d06ec3911bf559c9b4.tar.gz emacs-52f56d5a54184b4e9c5147d06ec3911bf559c9b4.zip | |
Remove more cal-tex code duplication
* calendar/cal-tex.el (cal-tex-rightday): Add optional funcname arg.
(cal-tex-shortday): New function.
(cal-tex-cursor-week-at-a-glance, cal-tex-cursor-filofax-week)
(cal-tex-cursor-filofax-daily): Use the above.
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/calendar/cal-tex.el | 73 |
2 files changed, 26 insertions, 52 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 3098d1657fc..c1c8c629083 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -9,6 +9,11 @@ | |||
| 9 | 9 | ||
| 10 | 2012-08-21 Glenn Morris <rgm@gnu.org> | 10 | 2012-08-21 Glenn Morris <rgm@gnu.org> |
| 11 | 11 | ||
| 12 | * calendar/cal-tex.el (cal-tex-rightday): Add optional funcname arg. | ||
| 13 | (cal-tex-shortday): New function. | ||
| 14 | (cal-tex-cursor-week-at-a-glance, cal-tex-cursor-filofax-week) | ||
| 15 | (cal-tex-cursor-filofax-daily): Use the above. | ||
| 16 | |||
| 12 | * calendar/cal-tex.el (cal-tex-leftday, cal-tex-rightday): | 17 | * calendar/cal-tex.el (cal-tex-leftday, cal-tex-rightday): |
| 13 | New functions. | 18 | New functions. |
| 14 | (cal-tex-cursor-week-at-a-glance, cal-tex-cursor-filofax-2week) | 19 | (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 1a64edc2071..4e32407c158 100644 --- a/lisp/calendar/cal-tex.el +++ b/lisp/calendar/cal-tex.el | |||
| @@ -268,6 +268,7 @@ Optional string ARGS are included as options for the article document class." | |||
| 268 | ""))) | 268 | ""))) |
| 269 | (if (stringp cal-tex-preamble-extra) | 269 | (if (stringp cal-tex-preamble-extra) |
| 270 | (insert cal-tex-preamble-extra "\n")) | 270 | (insert cal-tex-preamble-extra "\n")) |
| 271 | ;; FIXME boxwidth and boxheight unused? | ||
| 271 | (insert "\\hbadness 20000 | 272 | (insert "\\hbadness 20000 |
| 272 | \\hfuzz=1000pt | 273 | \\hfuzz=1000pt |
| 273 | \\vbadness 20000 | 274 | \\vbadness 20000 |
| @@ -381,9 +382,9 @@ landscape mode with three rows of four months each." | |||
| 381 | \\hbox to \\textwidth{\\vbox {\\noindent \\footnotesize \\em #4}}% | 382 | \\hbox to \\textwidth{\\vbox {\\noindent \\footnotesize \\em #4}}% |
| 382 | \\hbox to \\textwidth{\\vbox to 0pt {\\noindent \\footnotesize #3}}}}\\\\}\n")) | 383 | \\hbox to \\textwidth{\\vbox to 0pt {\\noindent \\footnotesize #3}}}}\\\\}\n")) |
| 383 | 384 | ||
| 384 | (defun cal-tex-rightday (height) | 385 | (defun cal-tex-rightday (height &optional funcname) |
| 385 | "Insert LaTeX code for rightday function." | 386 | "Insert LaTeX code for rightday function." |
| 386 | (insert "\\long\\def\\rightday#1#2#3#4#5{% | 387 | (insert "\\long\\def\\" (or funcname "rightday") "#1#2#3#4#5{% |
| 387 | \\rule{\\textwidth}{0.3pt}\\\\% | 388 | \\rule{\\textwidth}{0.3pt}\\\\% |
| 388 | \\hbox to \\textwidth{% | 389 | \\hbox to \\textwidth{% |
| 389 | \\vbox to " height "{% | 390 | \\vbox to " height "{% |
| @@ -392,6 +393,19 @@ landscape mode with three rows of four months each." | |||
| 392 | \\hbox to \\textwidth{\\vbox {\\raggedleft \\footnotesize \\em #4}}% | 393 | \\hbox to \\textwidth{\\vbox {\\raggedleft \\footnotesize \\em #4}}% |
| 393 | \\hbox to \\textwidth{\\vbox to 0pt {\\noindent \\footnotesize #3}}}}\\\\}\n")) | 394 | \\hbox to \\textwidth{\\vbox to 0pt {\\noindent \\footnotesize #3}}}}\\\\}\n")) |
| 394 | 395 | ||
| 396 | (defun cal-tex-shortday (funcname) | ||
| 397 | "Insert LaTeX code for a short day function." | ||
| 398 | (insert "\\long\\def\\" funcname "#1#2#3{% | ||
| 399 | \\rule{\\textwidth}{0.3pt}\\\\% | ||
| 400 | \\hbox to \\textwidth{% | ||
| 401 | \\vbox {% | ||
| 402 | \\vspace*{2pt}% | ||
| 403 | \\hbox to \\textwidth{\\hfill \\small #3 \\hfill}% | ||
| 404 | \\hbox to \\textwidth{\\vbox {\\" | ||
| 405 | (if (string-equal funcname "rightday") "raggedleft" "noindent") | ||
| 406 | " \\em #2}}% | ||
| 407 | \\hbox to \\textwidth{\\vbox {\\noindent \\footnotesize #1}}}}}\n")) | ||
| 408 | |||
| 395 | ;;;###cal-autoload | 409 | ;;;###cal-autoload |
| 396 | (defun cal-tex-cursor-filofax-year (&optional n event) | 410 | (defun cal-tex-cursor-filofax-year (&optional n event) |
| 397 | "Make a Filofax one page yearly calendar of year indicated by cursor. | 411 | "Make a Filofax one page yearly calendar of year indicated by cursor. |
| @@ -1083,16 +1097,7 @@ position to use instead of point." | |||
| 1083 | ") | 1097 | ") |
| 1084 | (insert cal-tex-righthead) | 1098 | (insert cal-tex-righthead) |
| 1085 | (cal-tex-rightday "2.75in") | 1099 | (cal-tex-rightday "2.75in") |
| 1086 | ;; FIXME this is just (cal-tex-rightday "1.8in"). | 1100 | (cal-tex-rightday "1.8in" "weekend") |
| 1087 | (insert "\\long\\def\\weekend#1#2#3#4#5{% | ||
| 1088 | \\rule{\\textwidth}{0.3pt}\\\\% | ||
| 1089 | \\hbox to \\textwidth{% | ||
| 1090 | \\vbox to 1.8in{% | ||
| 1091 | \\vspace*{2pt}% | ||
| 1092 | \\hbox to \\textwidth{\\small #5 \\hfill #1 {\\normalsize \\bf #2}}% | ||
| 1093 | \\hbox to \\textwidth{\\vbox {\\raggedleft \\footnotesize \\em #4}}% | ||
| 1094 | \\hbox to \\textwidth{\\vbox to 0pt {\\noindent \\footnotesize #3}}}}\\\\} | ||
| 1095 | ") | ||
| 1096 | (insert cal-tex-lefthead) | 1101 | (insert cal-tex-lefthead) |
| 1097 | (cal-tex-leftday "2.75in") | 1102 | (cal-tex-leftday "2.75in") |
| 1098 | (cal-tex-b-document) | 1103 | (cal-tex-b-document) |
| @@ -1295,16 +1300,7 @@ Optional EVENT indicates a buffer position to use instead of point." | |||
| 1295 | (cal-tex-filofax-paper) | 1300 | (cal-tex-filofax-paper) |
| 1296 | (insert cal-tex-righthead) | 1301 | (insert cal-tex-righthead) |
| 1297 | (cal-tex-rightday "1.85in") | 1302 | (cal-tex-rightday "1.85in") |
| 1298 | ;; FIXME this is just (cal-tex-rightday "0.8in"). | 1303 | (cal-tex-rightday "0.8in" "weekend") |
| 1299 | (insert "\\long\\def\\weekend#1#2#3#4#5{% | ||
| 1300 | \\rule{\\textwidth}{0.3pt}\\\\% | ||
| 1301 | \\hbox to \\textwidth{% | ||
| 1302 | \\vbox to .8in{% | ||
| 1303 | \\vspace*{2pt}% | ||
| 1304 | \\hbox to \\textwidth{\\small #5 \\hfill #1 {\\normalsize \\bf #2}}% | ||
| 1305 | \\hbox to \\textwidth{\\vbox {\\raggedleft \\footnotesize \\em #4}}% | ||
| 1306 | \\hbox to \\textwidth{\\vbox to 0pt {\\noindent \\footnotesize #3}}}}\\\\} | ||
| 1307 | ") | ||
| 1308 | (insert cal-tex-lefthead) | 1304 | (insert cal-tex-lefthead) |
| 1309 | (cal-tex-leftday "1.85in") | 1305 | (cal-tex-leftday "1.85in") |
| 1310 | (cal-tex-b-document) | 1306 | (cal-tex-b-document) |
| @@ -1413,37 +1409,10 @@ Optional EVENT indicates a buffer position to use instead of point." | |||
| 1413 | (cal-tex-preamble "twoside") | 1409 | (cal-tex-preamble "twoside") |
| 1414 | (cal-tex-filofax-paper) | 1410 | (cal-tex-filofax-paper) |
| 1415 | (insert cal-tex-righthead) | 1411 | (insert cal-tex-righthead) |
| 1416 | ;; Not quite cal-tex-rightday. | 1412 | (cal-tex-shortday "rightday") |
| 1417 | (insert "\\long\\def\\rightday#1#2#3{% | 1413 | (cal-tex-shortday "weekend") |
| 1418 | \\rule{\\textwidth}{0.3pt}\\\\% | ||
| 1419 | \\hbox to \\textwidth{% | ||
| 1420 | \\vbox {% | ||
| 1421 | \\vspace*{2pt}% | ||
| 1422 | \\hbox to \\textwidth{\\hfill \\small #3 \\hfill}% | ||
| 1423 | \\hbox to \\textwidth{\\vbox {\\raggedleft \\em #2}}% | ||
| 1424 | \\hbox to \\textwidth{\\vbox {\\noindent \\footnotesize #1}}}}} | ||
| 1425 | ") | ||
| 1426 | ;; FIXME this is just \rightday from above. | ||
| 1427 | (insert "\\long\\def\\weekend#1#2#3{% | ||
| 1428 | \\rule{\\textwidth}{0.3pt}\\\\% | ||
| 1429 | \\hbox to \\textwidth{% | ||
| 1430 | \\vbox {% | ||
| 1431 | \\vspace*{2pt}% | ||
| 1432 | \\hbox to \\textwidth{\\hfill \\small #3 \\hfill}% | ||
| 1433 | \\hbox to \\textwidth{\\vbox {\\noindent \\em #2}}% | ||
| 1434 | \\hbox to \\textwidth{\\vbox {\\noindent \\footnotesize #1}}}}} | ||
| 1435 | ") | ||
| 1436 | (insert cal-tex-lefthead) | 1414 | (insert cal-tex-lefthead) |
| 1437 | ;; Not quite cal-tex-leftday. | 1415 | (cal-tex-shortday "leftday") |
| 1438 | (insert "\\long\\def\\leftday#1#2#3{% | ||
| 1439 | \\rule{\\textwidth}{0.3pt}\\\\% | ||
| 1440 | \\hbox to \\textwidth{% | ||
| 1441 | \\vbox {% | ||
| 1442 | \\vspace*{2pt}% | ||
| 1443 | \\hbox to \\textwidth{\\hfill \\small #3 \\hfill}% | ||
| 1444 | \\hbox to \\textwidth{\\vbox {\\noindent \\em #2}}% | ||
| 1445 | \\hbox to \\textwidth{\\vbox {\\noindent \\footnotesize #1}}}}} | ||
| 1446 | ") | ||
| 1447 | (insert "\\newbox\\LineBox | 1416 | (insert "\\newbox\\LineBox |
| 1448 | \\setbox\\LineBox=\\hbox to\\textwidth{% | 1417 | \\setbox\\LineBox=\\hbox to\\textwidth{% |
| 1449 | \\vrule height.2in width0pt\\leaders\\hrule\\hfill} | 1418 | \\vrule height.2in width0pt\\leaders\\hrule\\hfill} |