[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r109728: Remove more cal-tex code dup
From: |
Glenn Morris |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r109728: Remove more cal-tex code duplication |
Date: |
Tue, 21 Aug 2012 14:15:56 -0400 |
User-agent: |
Bazaar (2.5.0) |
------------------------------------------------------------
revno: 109728
committer: Glenn Morris <address@hidden>
branch nick: trunk
timestamp: Tue 2012-08-21 14:15:56 -0400
message:
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.
modified:
lisp/ChangeLog
lisp/calendar/cal-tex.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2012-08-21 09:27:07 +0000
+++ b/lisp/ChangeLog 2012-08-21 18:15:56 +0000
@@ -9,6 +9,11 @@
2012-08-21 Glenn Morris <address@hidden>
+ * 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.
+
* calendar/cal-tex.el (cal-tex-leftday, cal-tex-rightday):
New functions.
(cal-tex-cursor-week-at-a-glance, cal-tex-cursor-filofax-2week)
=== modified file 'lisp/calendar/cal-tex.el'
--- a/lisp/calendar/cal-tex.el 2012-08-21 07:59:25 +0000
+++ b/lisp/calendar/cal-tex.el 2012-08-21 18:15:56 +0000
@@ -268,6 +268,7 @@
"")))
(if (stringp cal-tex-preamble-extra)
(insert cal-tex-preamble-extra "\n"))
+ ;; FIXME boxwidth and boxheight unused?
(insert "\\hbadness 20000
\\hfuzz=1000pt
\\vbadness 20000
@@ -381,9 +382,9 @@
\\hbox to \\textwidth{\\vbox {\\noindent \\footnotesize \\em #4}}%
\\hbox to \\textwidth{\\vbox to 0pt {\\noindent \\footnotesize
#3}}}}\\\\}\n"))
-(defun cal-tex-rightday (height)
+(defun cal-tex-rightday (height &optional funcname)
"Insert LaTeX code for rightday function."
- (insert "\\long\\def\\rightday#1#2#3#4#5{%
+ (insert "\\long\\def\\" (or funcname "rightday") "#1#2#3#4#5{%
\\rule{\\textwidth}{0.3pt}\\\\%
\\hbox to \\textwidth{%
\\vbox to " height "{%
@@ -392,6 +393,19 @@
\\hbox to \\textwidth{\\vbox {\\raggedleft \\footnotesize \\em #4}}%
\\hbox to \\textwidth{\\vbox to 0pt {\\noindent \\footnotesize
#3}}}}\\\\}\n"))
+(defun cal-tex-shortday (funcname)
+ "Insert LaTeX code for a short day function."
+ (insert "\\long\\def\\" funcname "#1#2#3{%
+ \\rule{\\textwidth}{0.3pt}\\\\%
+ \\hbox to \\textwidth{%
+ \\vbox {%
+ \\vspace*{2pt}%
+ \\hbox to \\textwidth{\\hfill \\small #3 \\hfill}%
+ \\hbox to \\textwidth{\\vbox {\\"
+ (if (string-equal funcname "rightday") "raggedleft" "noindent")
+ " \\em #2}}%
+ \\hbox to \\textwidth{\\vbox {\\noindent \\footnotesize #1}}}}}\n"))
+
;;;###cal-autoload
(defun cal-tex-cursor-filofax-year (&optional n event)
"Make a Filofax one page yearly calendar of year indicated by cursor.
@@ -1083,16 +1097,7 @@
")
(insert cal-tex-righthead)
(cal-tex-rightday "2.75in")
- ;; FIXME this is just (cal-tex-rightday "1.8in").
- (insert "\\long\\def\\weekend#1#2#3#4#5{%
- \\rule{\\textwidth}{0.3pt}\\\\%
- \\hbox to \\textwidth{%
- \\vbox to 1.8in{%
- \\vspace*{2pt}%
- \\hbox to \\textwidth{\\small #5 \\hfill #1 {\\normalsize \\bf #2}}%
- \\hbox to \\textwidth{\\vbox {\\raggedleft \\footnotesize \\em #4}}%
- \\hbox to \\textwidth{\\vbox to 0pt {\\noindent \\footnotesize
#3}}}}\\\\}
-")
+ (cal-tex-rightday "1.8in" "weekend")
(insert cal-tex-lefthead)
(cal-tex-leftday "2.75in")
(cal-tex-b-document)
@@ -1295,16 +1300,7 @@
(cal-tex-filofax-paper)
(insert cal-tex-righthead)
(cal-tex-rightday "1.85in")
- ;; FIXME this is just (cal-tex-rightday "0.8in").
- (insert "\\long\\def\\weekend#1#2#3#4#5{%
- \\rule{\\textwidth}{0.3pt}\\\\%
- \\hbox to \\textwidth{%
- \\vbox to .8in{%
- \\vspace*{2pt}%
- \\hbox to \\textwidth{\\small #5 \\hfill #1 {\\normalsize \\bf #2}}%
- \\hbox to \\textwidth{\\vbox {\\raggedleft \\footnotesize \\em #4}}%
- \\hbox to \\textwidth{\\vbox to 0pt {\\noindent \\footnotesize
#3}}}}\\\\}
-")
+ (cal-tex-rightday "0.8in" "weekend")
(insert cal-tex-lefthead)
(cal-tex-leftday "1.85in")
(cal-tex-b-document)
@@ -1413,37 +1409,10 @@
(cal-tex-preamble "twoside")
(cal-tex-filofax-paper)
(insert cal-tex-righthead)
- ;; Not quite cal-tex-rightday.
- (insert "\\long\\def\\rightday#1#2#3{%
- \\rule{\\textwidth}{0.3pt}\\\\%
- \\hbox to \\textwidth{%
- \\vbox {%
- \\vspace*{2pt}%
- \\hbox to \\textwidth{\\hfill \\small #3 \\hfill}%
- \\hbox to \\textwidth{\\vbox {\\raggedleft \\em #2}}%
- \\hbox to \\textwidth{\\vbox {\\noindent \\footnotesize #1}}}}}
-")
- ;; FIXME this is just \rightday from above.
- (insert "\\long\\def\\weekend#1#2#3{%
- \\rule{\\textwidth}{0.3pt}\\\\%
- \\hbox to \\textwidth{%
- \\vbox {%
- \\vspace*{2pt}%
- \\hbox to \\textwidth{\\hfill \\small #3 \\hfill}%
- \\hbox to \\textwidth{\\vbox {\\noindent \\em #2}}%
- \\hbox to \\textwidth{\\vbox {\\noindent \\footnotesize #1}}}}}
-")
+ (cal-tex-shortday "rightday")
+ (cal-tex-shortday "weekend")
(insert cal-tex-lefthead)
- ;; Not quite cal-tex-leftday.
- (insert "\\long\\def\\leftday#1#2#3{%
- \\rule{\\textwidth}{0.3pt}\\\\%
- \\hbox to \\textwidth{%
- \\vbox {%
- \\vspace*{2pt}%
- \\hbox to \\textwidth{\\hfill \\small #3 \\hfill}%
- \\hbox to \\textwidth{\\vbox {\\noindent \\em #2}}%
- \\hbox to \\textwidth{\\vbox {\\noindent \\footnotesize #1}}}}}
-")
+ (cal-tex-shortday "leftday")
(insert "\\newbox\\LineBox
\\setbox\\LineBox=\\hbox to\\textwidth{%
\\vrule height.2in width0pt\\leaders\\hrule\\hfill}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r109728: Remove more cal-tex code duplication,
Glenn Morris <=