Mercurial > hg > xemacs-beta
comparison etc/auctex/style/dinbrief.el @ 50:ee648375d8d6 r19-16b91
Import from CVS: tag r19-16b91
author | cvs |
---|---|
date | Mon, 13 Aug 2007 08:56:41 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
49:b46643e427ac | 50:ee648375d8d6 |
---|---|
1 ;;; dinbrief.el - Special code for LaTeX-Style dinbrief. | |
2 | |
3 ;; Contributed by Werner Fink <tex@itap.physik.uni-stuttgart.de> | |
4 ;; Please direct comments to him. | |
5 | |
6 ;;; Commentary: | |
7 | |
8 ;; LaTeX-Style: dinbrief.sty | |
9 ;; Server: rusinfo.rus.uni-stuttgart.de | |
10 ;; Directory: /pub/soft/tex/macros/latex/contrib/letters | |
11 | |
12 ;;; Code: | |
13 | |
14 (TeX-add-style-hook "dinbrief" | |
15 (function | |
16 (lambda () | |
17 (LaTeX-add-environments | |
18 '("letter" LaTeX-recipient-hook)) | |
19 (TeX-add-symbols | |
20 '("Absender" "Absender: ") | |
21 '("Postvermerk" "Postvermerk: ") | |
22 '("Datum" "Datum: ") | |
23 '("Betreff" "Betreff: ") | |
24 '("Behandlungsvermerk" "Behandlungsvermerk: ") | |
25 '("Verteiler" "Verteiler: ") | |
26 "makelabel" "Retourlabel" | |
27 '("Anlagen" "Anlagen: ") | |
28 '("Fenster" "Fenster \(ja/nein\): ") | |
29 '("Retouradresse" "Retouradresse: ") | |
30 '("signature" "Unterschrift: ") | |
31 '("opening" "Anrede: ") | |
32 '("closing" "Schlu\"s: "))))) | |
33 | |
34 (defun LaTeX-recipient-hook (environment) | |
35 "Insert ENVIRONMENT and prompt for recipient and address." | |
36 (let ((sender (read-input "Absender: " (user-full-name))) | |
37 (recipient (read-input "Empf\"anger: ")) | |
38 (address (read-input "Anschrift: ")) | |
39 (postvermerk (read-input "Postvermerk: ")) | |
40 (date (read-input "Datum: " (LaTeX-today))) | |
41 (betreff (read-input "Betreff: ")) | |
42 (vermerk (read-input "Behandlungsvermerk: ")) | |
43 (verteil (read-input "Verteiler: ")) | |
44 (anlage (read-input "Anlagen: ")) | |
45 (opening (read-input "Anrede: ")) | |
46 (closing (read-input "Schlu\"s: ")) | |
47 (fenster (read-input "Fenster \(ja/nein\): ")) | |
48 (signature (read-input "Unterschrift: ")) | |
49 ) | |
50 | |
51 (if (not (zerop (length sender))) | |
52 (progn | |
53 (insert TeX-esc "Absender" TeX-grop sender TeX-grcl) | |
54 (newline-and-indent))) | |
55 (if (not (zerop (length postvermerk))) | |
56 (progn | |
57 (insert TeX-esc "Postvermerk" TeX-grop postvermerk TeX-grcl) | |
58 (newline-and-indent))) | |
59 (if (not (zerop (length betreff))) | |
60 (progn | |
61 (insert TeX-esc "Betreff" TeX-grop betreff TeX-grcl) | |
62 (newline-and-indent))) | |
63 (if (not (zerop (length vermerk))) | |
64 (progn | |
65 (insert TeX-esc "Behandlungsvermerk" TeX-grop vermerk TeX-grcl) | |
66 (newline-and-indent))) | |
67 (if (not (zerop (length verteil))) | |
68 (progn | |
69 (insert TeX-esc "Verteiler" TeX-grop verteil TeX-grcl) | |
70 (newline-and-indent))) | |
71 (if (not (zerop (length anlage))) | |
72 (progn | |
73 (insert TeX-esc "Anlagen" TeX-grop anlage TeX-grcl) | |
74 (newline-and-indent))) | |
75 (if (string= fenster "ja") | |
76 (progn | |
77 (insert TeX-esc "Fenster") | |
78 (let ((retouradr (read-input "Retouradresse: " (user-full-name)))) | |
79 (newline-and-indent) | |
80 (if (not (zerop (length retouradr))) | |
81 (progn | |
82 (insert TeX-esc "Retouradresse" TeX-grop retouradr TeX-grcl) | |
83 (newline-and-indent)))))) | |
84 (if (not (zerop (length signature))) | |
85 (progn | |
86 (insert TeX-esc "signature" TeX-grop signature TeX-grcl) | |
87 (newline-and-indent))) | |
88 (if (not (zerop (length date))) | |
89 (progn | |
90 (insert TeX-esc "Datum" TeX-grop date TeX-grcl) | |
91 (newline-and-indent))) | |
92 (newline-and-indent) | |
93 | |
94 (let ((indentation (current-column))) | |
95 (LaTeX-insert-environment | |
96 environment | |
97 (concat TeX-grop recipient | |
98 (if (not (zerop (length address))) | |
99 (concat | |
100 (if (not (zerop (length recipient))) | |
101 (concat " " TeX-esc TeX-esc " ")) | |
102 address)) | |
103 TeX-grcl)) | |
104 (save-excursion ; Fix indentation of address | |
105 (if (search-backward TeX-grcl nil 'move) | |
106 (let ((addr-end (point-marker))) | |
107 (if (search-backward TeX-grop nil 'move) | |
108 (let ((addr-column (current-column))) | |
109 (while (search-forward | |
110 (concat TeX-esc TeX-esc) | |
111 (marker-position addr-end) 'move) | |
112 (progn | |
113 (newline) | |
114 (indent-to addr-column)))))))) | |
115 (insert "\n") | |
116 (indent-to indentation)) | |
117 (insert TeX-esc "opening" | |
118 TeX-grop | |
119 (if (zerop (length opening)) | |
120 (concat TeX-esc " ") | |
121 opening) | |
122 TeX-grcl "\n") | |
123 | |
124 (indent-relative-maybe) | |
125 (save-excursion | |
126 (insert "\n" TeX-esc "closing" | |
127 TeX-grop | |
128 (if (zerop (length closing)) | |
129 (concat TeX-esc " ") | |
130 closing) | |
131 TeX-grcl "\n") | |
132 (indent-relative-maybe)))) | |
133 | |
134 (defun LaTeX-today nil | |
135 "Return a string representing todays date according to flavor." | |
136 (interactive) | |
137 (let ((ctime-string (current-time-string)) | |
138 (month-alist '(("Jan" . "Januar") | |
139 ("Feb" . "Februar") | |
140 ("Mar" . "M\\\"arz") | |
141 ("Apr" . "April") | |
142 ("May" . "Mai") | |
143 ("Jun" . "Juni") | |
144 ("Jul" . "Juli") | |
145 ("Aug" . "August") | |
146 ("Sep" . "September") | |
147 ("Oct" . "Oktober") | |
148 ("Nov" . "November") | |
149 ("Dec" . "Dezember")))) | |
150 (string-match | |
151 "^\\S-+\\s-+\\(\\S-+\\)\\s-+\\(\\S-+\\)\\s-+\\S-+\\s-+\\(\\S-+\\)" | |
152 ctime-string) | |
153 (let ((year (substring ctime-string (match-beginning 3) (match-end 3))) | |
154 (month (substring ctime-string (match-beginning 1) (match-end 1))) | |
155 (day (substring ctime-string (match-beginning 2) (match-end 2)))) | |
156 (if (assoc month month-alist) | |
157 (progn | |
158 (setq month (cdr (assoc month month-alist))) | |
159 (if (> 2 (length day)) | |
160 (setq day (concat "0" day))))) | |
161 (format "Stuttgart, den %s. %s %s" day month year)))) | |
162 | |
163 ;;; dinbrief.el ends here |