diff options
| author | Glenn Morris | 2008-04-01 02:43:57 +0000 |
|---|---|---|
| committer | Glenn Morris | 2008-04-01 02:43:57 +0000 |
| commit | c7af68bcfca9f16792e7131209f77235f2823e52 (patch) | |
| tree | 98b4f4f5e8c0c4676a02923666c4dc5d27a3cdfd | |
| parent | e5e9977663650995435f90e00e4517f49ef55310 (diff) | |
| download | emacs-c7af68bcfca9f16792e7131209f77235f2823e52.tar.gz emacs-c7af68bcfca9f16792e7131209f77235f2823e52.zip | |
(cal-tex-cursor-month-landscape)
(cal-tex-cursor-month, cal-tex-LaTeXify-string): Reduce nesting of some lets.
| -rw-r--r-- | lisp/calendar/cal-tex.el | 169 |
1 files changed, 84 insertions, 85 deletions
diff --git a/lisp/calendar/cal-tex.el b/lisp/calendar/cal-tex.el index 8fe6eb23deb..8ac491d3e9a 100644 --- a/lisp/calendar/cal-tex.el +++ b/lisp/calendar/cal-tex.el | |||
| @@ -436,55 +436,54 @@ month to a page. It shows holiday and diary entries if | |||
| 436 | (d2 (calendar-absolute-from-gregorian | 436 | (d2 (calendar-absolute-from-gregorian |
| 437 | (list end-month | 437 | (list end-month |
| 438 | (calendar-last-day-of-month end-month end-year) | 438 | (calendar-last-day-of-month end-month end-year) |
| 439 | end-year)))) | 439 | end-year))) |
| 440 | (increment-calendar-month end-month end-year (1- n)) | 440 | (diary-list (progn |
| 441 | (let ((diary-list (if cal-tex-diary | 441 | (increment-calendar-month end-month end-year (1- n)) |
| 442 | (cal-tex-list-diary-entries d1 d2))) | 442 | (if cal-tex-diary (cal-tex-list-diary-entries d1 d2)))) |
| 443 | (holidays (if cal-tex-holidays | 443 | (holidays (if cal-tex-holidays (cal-tex-list-holidays d1 d2))) |
| 444 | (cal-tex-list-holidays d1 d2))) | 444 | other-month other-year small-months-at-start) |
| 445 | other-month other-year small-months-at-start) | 445 | (cal-tex-insert-preamble (cal-tex-number-weeks month year 1) t "12pt") |
| 446 | (cal-tex-insert-preamble (cal-tex-number-weeks month year 1) t "12pt") | 446 | (cal-tex-cmd cal-tex-cal-one-month) |
| 447 | (cal-tex-cmd cal-tex-cal-one-month) | 447 | (dotimes (i n) |
| 448 | (dotimes (i n) | 448 | (setq other-month month |
| 449 | (setq other-month month | 449 | other-year year) |
| 450 | other-year year) | 450 | (increment-calendar-month other-month other-year -1) |
| 451 | (increment-calendar-month other-month other-year -1) | 451 | (insert (cal-tex-mini-calendar other-month other-year "lastmonth" |
| 452 | (insert (cal-tex-mini-calendar other-month other-year "lastmonth" | 452 | "\\cellwidth" "\\cellheight")) |
| 453 | "\\cellwidth" "\\cellheight")) | 453 | (increment-calendar-month other-month other-year 2) |
| 454 | (increment-calendar-month other-month other-year 2) | 454 | (insert (cal-tex-mini-calendar other-month other-year "nextmonth" |
| 455 | (insert (cal-tex-mini-calendar other-month other-year "nextmonth" | 455 | "\\cellwidth" "\\cellheight")) |
| 456 | "\\cellwidth" "\\cellheight")) | 456 | (cal-tex-insert-month-header 1 month year month year) |
| 457 | (cal-tex-insert-month-header 1 month year month year) | 457 | (cal-tex-insert-day-names) |
| 458 | (cal-tex-insert-day-names) | 458 | (cal-tex-nl ".2cm") |
| 459 | (cal-tex-nl ".2cm") | 459 | (if (setq small-months-at-start |
| 460 | (if (setq small-months-at-start | 460 | (< 1 (mod (- (calendar-day-of-week (list month 1 year)) |
| 461 | (< 1 (mod (- (calendar-day-of-week (list month 1 year)) | ||
| 462 | calendar-week-start-day) | 461 | calendar-week-start-day) |
| 463 | 7))) | 462 | 7))) |
| 464 | (insert "\\lastmonth\\nextmonth\\hspace*{-2\\cellwidth}")) | 463 | (insert "\\lastmonth\\nextmonth\\hspace*{-2\\cellwidth}")) |
| 465 | (cal-tex-insert-blank-days month year cal-tex-day-prefix) | 464 | (cal-tex-insert-blank-days month year cal-tex-day-prefix) |
| 466 | (cal-tex-insert-days month year diary-list holidays | 465 | (cal-tex-insert-days month year diary-list holidays |
| 467 | cal-tex-day-prefix) | 466 | cal-tex-day-prefix) |
| 468 | (cal-tex-insert-blank-days-at-end month year cal-tex-day-prefix) | 467 | (cal-tex-insert-blank-days-at-end month year cal-tex-day-prefix) |
| 469 | (if (and (not small-months-at-start) | 468 | (if (and (not small-months-at-start) |
| 470 | (< 1 (mod (- (1- calendar-week-start-day) | 469 | (< 1 (mod (- (1- calendar-week-start-day) |
| 471 | (calendar-day-of-week | 470 | (calendar-day-of-week |
| 472 | (list month | 471 | (list month |
| 473 | (calendar-last-day-of-month month year) | 472 | (calendar-last-day-of-month month year) |
| 474 | year))) | 473 | year))) |
| 475 | 7))) | 474 | 7))) |
| 476 | (insert "\\vspace*{-\\cellwidth}\\hspace*{-2\\cellwidth}" | 475 | (insert "\\vspace*{-\\cellwidth}\\hspace*{-2\\cellwidth}" |
| 477 | "\\lastmonth\\nextmonth% | 476 | "\\lastmonth\\nextmonth% |
| 478 | ")) | 477 | ")) |
| 479 | (unless (= i (1- n)) | 478 | (unless (= i (1- n)) |
| 480 | (run-hooks 'cal-tex-month-hook) | 479 | (run-hooks 'cal-tex-month-hook) |
| 481 | (cal-tex-newpage) | 480 | (cal-tex-newpage) |
| 482 | (increment-calendar-month month year 1) | 481 | (increment-calendar-month month year 1) |
| 483 | (cal-tex-vspace "-2cm") | 482 | (cal-tex-vspace "-2cm") |
| 484 | (cal-tex-insert-preamble | 483 | (cal-tex-insert-preamble |
| 485 | (cal-tex-number-weeks month year 1) t "12pt" t))) | 484 | (cal-tex-number-weeks month year 1) t "12pt" t)))) |
| 486 | (cal-tex-end-document) | 485 | (cal-tex-end-document) |
| 487 | (run-hooks 'cal-tex-hook)))) | 486 | (run-hooks 'cal-tex-hook)) |
| 488 | 487 | ||
| 489 | ;;;###cal-autoload | 488 | ;;;###cal-autoload |
| 490 | (defun cal-tex-cursor-month (arg) | 489 | (defun cal-tex-cursor-month (arg) |
| @@ -494,45 +493,44 @@ produced (default 1). The calendar is condensed onto one page. | |||
| 494 | It shows holiday and diary entries if `cal-tex-holidays' and | 493 | It shows holiday and diary entries if `cal-tex-holidays' and |
| 495 | `cal-tex-diary', respectively, are non-nil." | 494 | `cal-tex-diary', respectively, are non-nil." |
| 496 | (interactive "p") | 495 | (interactive "p") |
| 497 | (let* ((date (calendar-cursor-to-date t)) | 496 | (let* ((n (or arg 1)) |
| 497 | (date (calendar-cursor-to-date t)) | ||
| 498 | (month (extract-calendar-month date)) | 498 | (month (extract-calendar-month date)) |
| 499 | (year (extract-calendar-year date)) | 499 | (year (extract-calendar-year date)) |
| 500 | (end-month month) | 500 | (end-month month) |
| 501 | (end-year year) | 501 | (end-year year) |
| 502 | (n (or arg 1)) | ||
| 503 | (d1 (calendar-absolute-from-gregorian (list month 1 year))) | 502 | (d1 (calendar-absolute-from-gregorian (list month 1 year))) |
| 504 | (d2 (calendar-absolute-from-gregorian | 503 | (d2 (calendar-absolute-from-gregorian |
| 505 | (list end-month | 504 | (list end-month |
| 506 | (calendar-last-day-of-month end-month end-year) | 505 | (calendar-last-day-of-month end-month end-year) |
| 507 | end-year)))) | 506 | end-year))) |
| 508 | (increment-calendar-month end-month end-year (1- n)) | 507 | (diary-list (progn |
| 509 | (let ((diary-list (if cal-tex-diary | 508 | (increment-calendar-month end-month end-year (1- n)) |
| 510 | (cal-tex-list-diary-entries d1 d2))) | 509 | (if cal-tex-diary (cal-tex-list-diary-entries d1 d2)))) |
| 511 | (holidays (if cal-tex-holidays | 510 | (holidays (if cal-tex-holidays (cal-tex-list-holidays d1 d2))) |
| 512 | (cal-tex-list-holidays d1 d2))) | 511 | other-month other-year) |
| 513 | other-month other-year) | 512 | (cal-tex-insert-preamble (cal-tex-number-weeks month year n) nil "12pt") |
| 514 | (cal-tex-insert-preamble (cal-tex-number-weeks month year n) nil"12pt") | 513 | (if (> n 1) |
| 515 | (if (> n 1) | 514 | (cal-tex-cmd cal-tex-cal-multi-month) |
| 516 | (cal-tex-cmd cal-tex-cal-multi-month) | 515 | (cal-tex-cmd cal-tex-cal-one-month)) |
| 517 | (cal-tex-cmd cal-tex-cal-one-month)) | 516 | (cal-tex-insert-month-header n month year end-month end-year) |
| 518 | (cal-tex-insert-month-header n month year end-month end-year) | 517 | (cal-tex-insert-day-names) |
| 519 | (cal-tex-insert-day-names) | 518 | (cal-tex-nl ".2cm") |
| 520 | (cal-tex-nl ".2cm") | 519 | (cal-tex-insert-blank-days month year cal-tex-day-prefix) |
| 521 | (cal-tex-insert-blank-days month year cal-tex-day-prefix) | 520 | (dotimes (idummy n) |
| 522 | (dotimes (idummy n) | 521 | (setq other-month month |
| 523 | (setq other-month month | 522 | other-year year) |
| 524 | other-year year) | 523 | (cal-tex-insert-days month year diary-list holidays cal-tex-day-prefix) |
| 525 | (cal-tex-insert-days month year diary-list holidays cal-tex-day-prefix) | 524 | (when (= 6 (mod (calendar-absolute-from-gregorian |
| 526 | (when (= 6 (mod (calendar-absolute-from-gregorian | 525 | (list month |
| 527 | (list month | 526 | (calendar-last-day-of-month month year) |
| 528 | (calendar-last-day-of-month month year) | 527 | year)) |
| 529 | year)) | 528 | 7)) ; last day of month was Saturday |
| 530 | 7)) ; last day of month was Saturday | 529 | (cal-tex-hfill) |
| 531 | (cal-tex-hfill) | 530 | (cal-tex-nl)) |
| 532 | (cal-tex-nl)) | 531 | (increment-calendar-month month year 1)) |
| 533 | (increment-calendar-month month year 1)) | 532 | (cal-tex-insert-blank-days-at-end end-month end-year cal-tex-day-prefix)) |
| 534 | (cal-tex-insert-blank-days-at-end end-month end-year cal-tex-day-prefix) | 533 | (cal-tex-end-document) |
| 535 | (cal-tex-end-document))) | ||
| 536 | (run-hooks 'cal-tex-hook)) | 534 | (run-hooks 'cal-tex-hook)) |
| 537 | 535 | ||
| 538 | (defun cal-tex-insert-days (month year diary-list holidays day-format) | 536 | (defun cal-tex-insert-days (month year diary-list holidays day-format) |
| @@ -1633,14 +1631,15 @@ non-nil, means add to end of buffer without erasing current contents." | |||
| 1633 | "" | 1631 | "" |
| 1634 | (let ((head "") | 1632 | (let ((head "") |
| 1635 | (tail string) | 1633 | (tail string) |
| 1636 | (list cal-tex-LaTeX-subst-list)) | 1634 | (list cal-tex-LaTeX-subst-list) |
| 1635 | ch pair) | ||
| 1637 | (while (not (string-equal tail "")) | 1636 | (while (not (string-equal tail "")) |
| 1638 | (let* ((ch (substring-no-properties tail 0 1)) | 1637 | (setq ch (substring-no-properties tail 0 1) |
| 1639 | (pair (assoc ch list))) | 1638 | pair (assoc ch list)) |
| 1640 | (if (and pair (string-equal ch "\"")) | 1639 | (if (and pair (string-equal ch "\"")) |
| 1641 | (setq list (reverse list))) ; quote changes meaning each time | 1640 | (setq list (reverse list))) ; quote changes meaning each time |
| 1642 | (setq tail (substring-no-properties tail 1) | 1641 | (setq tail (substring-no-properties tail 1) |
| 1643 | head (concat head (if pair (cdr pair) ch))))) | 1642 | head (concat head (if pair (cdr pair) ch)))) |
| 1644 | head))) | 1643 | head))) |
| 1645 | 1644 | ||
| 1646 | (defun cal-tex-month-name (month) | 1645 | (defun cal-tex-month-name (month) |