7260
|
1 ;; iso-cvt.el -- translate to ISO 8859-1 from/to net/TeX conventions
|
|
2 ;; Copyright © 1993 Free Software Foundation, Inc.
|
|
3 ;; Was formerly called gm-lingo.el.
|
|
4
|
|
5 ;; Author: Michael Gschwind <mike@vlsivie.tuwien.ac.at>
|
|
6 ;; Keywords: tex, iso, latin, i18n
|
|
7
|
|
8 ;; This file is part of GNU Emacs.
|
|
9
|
|
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
|
|
11 ;; it under the terms of the GNU General Public License as published by
|
|
12 ;; the Free Software Foundation; either version 2, or (at your option)
|
|
13 ;; any later version.
|
|
14
|
|
15 ;; GNU Emacs is distributed in the hope that it will be useful,
|
|
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
18 ;; GNU General Public License for more details.
|
|
19
|
|
20 ;; You should have received a copy of the GNU General Public License
|
|
21 ;; along with GNU Emacs; see the file COPYING. If not, write to
|
|
22 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
23
|
|
24 ;;; Commentary:
|
|
25
|
|
26 ; Calling `iso-german' will turn the net convention f or umlauts ("a etc.)
|
|
27 ; into ISO latin umlaute for easy reading.
|
|
28 ; hooks change TeX files to Latin-1 for editing and back to TeX sequences
|
|
29 ; for calling TeX. An alternative is a TeX style that handles
|
|
30 ; 8 bit ISO files (available on ftp.vlsivie.tuwien.ac.at in /pub/8bit)
|
|
31 ; - but these files are difficult to transmit ... so while the net is
|
|
32 ; still @ 7 bit this may be useful
|
|
33
|
|
34 ; to do: translate buffer when displaying from GNUS,
|
|
35 ; use function 'german which does the Right Thing
|
|
36 ;
|
|
37 ; to do: use more general regular expressions for (g)tex2iso tables, to
|
|
38 ; cover more cases for translation.
|
|
39
|
|
40 ;;; Code:
|
|
41
|
|
42 (provide 'iso-cvt)
|
|
43
|
|
44 (defvar iso-spanish-trans-tab
|
|
45 '(
|
|
46 ("~n" "ñ")
|
|
47 ("\([a-zA-Z]\)#" "\\1ñ")
|
|
48 ("~N" "Ñ")
|
|
49 ("\\([-a-zA-Z\"`]\\)\"u" "\\1ü")
|
|
50 ("\\([-a-zA-Z\"`]\\)\"U" "\\1Ü")
|
|
51 ("\\([-a-zA-Z]\\)'o" "\\1ó")
|
|
52 ("\\([-a-zA-Z]\\)'O" "\\Ó")
|
|
53 ("\\([-a-zA-Z]\\)'e" "\\1é")
|
|
54 ("\\([-a-zA-Z]\\)'E" "\\1É")
|
|
55 ("\\([-a-zA-Z]\\)'a" "\\1á")
|
|
56 ("\\([-a-zA-Z]\\)'A" "\\1A")
|
|
57 ("\\([-a-zA-Z]\\)'i" "\\1í")
|
|
58 ("\\([-a-zA-Z]\\)'I" "\\1Í")
|
|
59 )
|
|
60 "Spanish translation table.")
|
|
61
|
|
62 (defun iso-translate-conventions (trans-tab)
|
|
63 "Use the translation table argument to translate the current buffer."
|
|
64 (interactive)
|
|
65 (save-excursion
|
|
66 (widen)
|
|
67 (goto-char (point-min))
|
|
68 (let ((work-tab trans-tab)
|
|
69 (buffer-read-only nil))
|
|
70 (while work-tab
|
|
71 (save-excursion
|
|
72 (let ((trans-this (car work-tab)))
|
|
73 (while (re-search-forward (car trans-this) nil t)
|
|
74 (replace-match (car (cdr trans-this)) nil nil)))
|
|
75 (setq work-tab (cdr work-tab)))))))
|
|
76
|
|
77 (defun iso-spanish ()
|
|
78 "Translate net conventions for Spanish to ISO 8859-1."
|
|
79 (interactive)
|
|
80 (iso-translate-conventions iso-spanish-trans-tab))
|
|
81
|
|
82 (defvar iso-aggressive-german-trans-tab
|
|
83 '(
|
|
84 ("\"a" "ä")
|
|
85 ("\"A" "Ä")
|
|
86 ("\"o" "ö")
|
|
87 ("\"O" "Ö")
|
|
88 ("\"u" "ü")
|
|
89 ("\"U" "Ü")
|
|
90 ("\"s" "ß")
|
|
91 ("\\\\3" "ß")
|
|
92 )
|
|
93 "German translation table.
|
|
94 This table uses an aggressive translation approach and may translate
|
|
95 erroneously translate too much.")
|
|
96
|
|
97 (defvar iso-conservative-german-trans-tab
|
|
98 '(
|
|
99 ("\\([-a-zA-Z\"`]\\)\"a" "\\1ä")
|
|
100 ("\\([-a-zA-Z\"`]\\)\"A" "\\1Ä")
|
|
101 ("\\([-a-zA-Z\"`]\\)\"o" "\\1ö")
|
|
102 ("\\([-a-zA-Z\"`]\\)\"O" "\\1Ö")
|
|
103 ("\\([-a-zA-Z\"`]\\)\"u" "\\1ü")
|
|
104 ("\\([-a-zA-Z\"`]\\)\"U" "\\1Ü")
|
|
105 ("\\([-a-zA-Z\"`]\\)\"s" "\\1ß")
|
|
106 ("\\([-a-zA-Z\"`]\\)\\\\3" "\\1ß")
|
|
107 )
|
|
108 "German translation table.
|
|
109 This table uses a conservative translation approach and may translate too
|
|
110 little.")
|
|
111
|
|
112
|
|
113 (defvar iso-german-trans-tab iso-aggressive-german-trans-tab
|
|
114 "Currently active translation table for German.")
|
|
115
|
|
116 (defun iso-german ()
|
|
117 "Translate net conventions for German to ISO 8859-1."
|
|
118 (interactive)
|
|
119 (iso-translate-conventions iso-german-trans-tab))
|
|
120
|
|
121 (defvar iso-iso2tex-trans-tab
|
|
122 '(
|
|
123 ("ä" "{\\\\\"a}")
|
|
124 ("à" "{\\\\`a}")
|
|
125 ("á" "{\\\\'a}")
|
|
126 ("ã" "{\\\\~a}")
|
|
127 ("â" "{\\\\^a}")
|
|
128 ("ë" "{\\\\\"e}")
|
|
129 ("è" "{\\\\`e}")
|
|
130 ("é" "{\\\\'e}")
|
|
131 ("ê" "{\\\\^e}")
|
|
132 ("ï" "{\\\\\"\\\\i}")
|
|
133 ("ì" "{\\\\`\\\\i}")
|
|
134 ("í" "{\\\\'\\\\i}")
|
|
135 ("î" "{\\\\^\\\\i}")
|
|
136 ("ö" "{\\\\\"o}")
|
|
137 ("ò" "{\\\\`o}")
|
|
138 ("ó" "{\\\\'o}")
|
|
139 ("õ" "{\\\\~o}")
|
|
140 ("ô" "{\\\\^o}")
|
|
141 ("ü" "{\\\\\"u}")
|
|
142 ("ù" "{\\\\`u}")
|
|
143 ("ú" "{\\\\'u}")
|
|
144 ("û" "{\\\\^u}")
|
|
145 ("Ä" "{\\\\\"A}")
|
|
146 ("À" "{\\\\`A}")
|
|
147 ("Á" "{\\\\'A}")
|
|
148 ("Ã" "{\\\\~A}")
|
|
149 ("Â" "{\\\\^A}")
|
|
150 ("Ë" "{\\\\\"E}")
|
|
151 ("È" "{\\\\`E}")
|
|
152 ("É" "{\\\\'E}")
|
|
153 ("Ê" "{\\\\^E}")
|
|
154 ("Ï" "{\\\\\"I}")
|
|
155 ("Ì" "{\\\\`I}")
|
|
156 ("Í" "{\\\\'I}")
|
|
157 ("Î" "{\\\\^I}")
|
|
158 ("Ö" "{\\\\\"O}")
|
|
159 ("Ò" "{\\\\`O}")
|
|
160 ("Ó" "{\\\\'O}")
|
|
161 ("Õ" "{\\\\~O}")
|
|
162 ("Ô" "{\\\\^O}")
|
|
163 ("Ü" "{\\\\\"U}")
|
|
164 ("Ù" "{\\\\`U}")
|
|
165 ("Ú" "{\\\\'U}")
|
|
166 ("Û" "{\\\\^U}")
|
|
167 ("ñ" "{\\\\~n}")
|
|
168 ("Ñ" "{\\\\~N}")
|
|
169 ("ç" "{\\\\c c}")
|
|
170 ("Ç" "{\\\\c C}")
|
|
171 ("ß" "{\\\\ss}")
|
|
172 ("¿" "{?`}")
|
|
173 ("¡" "{!`}")
|
|
174 )
|
|
175 "Translation table for translating ISO 8859-1 characters to TeX sequences.")
|
|
176
|
|
177
|
|
178
|
|
179
|
|
180 (defun iso-iso2tex ()
|
|
181 "Translate ISO 8859-1 characters to TeX sequences."
|
|
182 (interactive)
|
|
183 (iso-translate-conventions iso-iso2tex-trans-tab))
|
|
184
|
|
185
|
|
186 (defvar iso-tex2iso-trans-tab
|
|
187 '(
|
|
188 ("{\\\\\"a}" "ä")
|
|
189 ("{\\\\`a}" "à")
|
|
190 ("{\\\\'a}" "á")
|
|
191 ("{\\\\~a}" "ã")
|
|
192 ("{\\\\^a}" "â")
|
|
193 ("{\\\\\"e}" "ë")
|
|
194 ("{\\\\`e}" "è")
|
|
195 ("{\\\\'e}" "é")
|
|
196 ("{\\\\^e}" "ê")
|
|
197 ("{\\\\\"\\\\i}" "ï")
|
|
198 ("{\\\\`\\\\i}" "ì")
|
|
199 ("{\\\\'\\\\i}" "í")
|
|
200 ("{\\\\^\\\\i}" "î")
|
|
201 ("{\\\\\"i}" "ï")
|
|
202 ("{\\\\`i}" "ì")
|
|
203 ("{\\\\'i}" "í")
|
|
204 ("{\\\\^i}" "î")
|
|
205 ("{\\\\\"o}" "ö")
|
|
206 ("{\\\\`o}" "ò")
|
|
207 ("{\\\\'o}" "ó")
|
|
208 ("{\\\\~o}" "õ")
|
|
209 ("{\\\\^o}" "ô")
|
|
210 ("{\\\\\"u}" "ü")
|
|
211 ("{\\\\`u}" "ù")
|
|
212 ("{\\\\'u}" "ú")
|
|
213 ("{\\\\^u}" "û")
|
|
214 ("{\\\\\"A}" "Ä")
|
|
215 ("{\\\\`A}" "À")
|
|
216 ("{\\\\'A}" "Á")
|
|
217 ("{\\\\~A}" "Ã")
|
|
218 ("{\\\\^A}" "Â")
|
|
219 ("{\\\\\"E}" "Ë")
|
|
220 ("{\\\\`E}" "È")
|
|
221 ("{\\\\'E}" "É")
|
|
222 ("{\\\\^E}" "Ê")
|
|
223 ("{\\\\\"I}" "Ï")
|
|
224 ("{\\\\`I}" "Ì")
|
|
225 ("{\\\\'I}" "Í")
|
|
226 ("{\\\\^I}" "Î")
|
|
227 ("{\\\\\"O}" "Ö")
|
|
228 ("{\\\\`O}" "Ò")
|
|
229 ("{\\\\'O}" "Ó")
|
|
230 ("{\\\\~O}" "Õ")
|
|
231 ("{\\\\^O}" "Ô")
|
|
232 ("{\\\\\"U}" "Ü")
|
|
233 ("{\\\\`U}" "Ù")
|
|
234 ("{\\\\'U}" "Ú")
|
|
235 ("{\\\\^U}" "Û")
|
|
236 ("{\\\\~n}" "ñ")
|
|
237 ("{\\\\~N}" "Ñ")
|
|
238 ("{\\\\c c}" "ç")
|
|
239 ("{\\\\c C}" "Ç")
|
|
240 ("\\\\\"{a}" "ä")
|
|
241 ("\\\\`{a}" "à")
|
|
242 ("\\\\'{a}" "á")
|
|
243 ("\\\\~{a}" "ã")
|
|
244 ("\\\\^{a}" "â")
|
|
245 ("\\\\\"{e}" "ë")
|
|
246 ("\\\\`{e}" "è")
|
|
247 ("\\\\'{e}" "é")
|
|
248 ("\\\\^{e}" "ê")
|
|
249 ("\\\\\"{\\\\i}" "ï")
|
|
250 ("\\\\`{\\\\i}" "ì")
|
|
251 ("\\\\'{\\\\i}" "í")
|
|
252 ("\\\\^{\\\\i}" "î")
|
|
253 ("\\\\\"{i}" "ï")
|
|
254 ("\\\\`{i}" "ì")
|
|
255 ("\\\\'{i}" "í")
|
|
256 ("\\\\^{i}" "î")
|
|
257 ("\\\\\"{o}" "ö")
|
|
258 ("\\\\`{o}" "ò")
|
|
259 ("\\\\'{o}" "ó")
|
|
260 ("\\\\~{o}" "õ")
|
|
261 ("\\\\^{o}" "ô")
|
|
262 ("\\\\\"{u}" "ü")
|
|
263 ("\\\\`{u}" "ù")
|
|
264 ("\\\\'{u}" "ú")
|
|
265 ("\\\\^{u}" "û")
|
|
266 ("\\\\\"{A}" "Ä")
|
|
267 ("\\\\`{A}" "À")
|
|
268 ("\\\\'{A}" "Á")
|
|
269 ("\\\\~{A}" "Ã")
|
|
270 ("\\\\^{A}" "Â")
|
|
271 ("\\\\\"{E}" "Ë")
|
|
272 ("\\\\`{E}" "È")
|
|
273 ("\\\\'{E}" "É")
|
|
274 ("\\\\^{E}" "Ê")
|
|
275 ("\\\\\"{I}" "Ï")
|
|
276 ("\\\\`{I}" "Ì")
|
|
277 ("\\\\'{I}" "Í")
|
|
278 ("\\\\^{I}" "Î")
|
|
279 ("\\\\\"{O}" "Ö")
|
|
280 ("\\\\`{O}" "Ò")
|
|
281 ("\\\\'{O}" "Ó")
|
|
282 ("\\\\~{O}" "Õ")
|
|
283 ("\\\\^{O}" "Ô")
|
|
284 ("\\\\\"{U}" "Ü")
|
|
285 ("\\\\`{U}" "Ù")
|
|
286 ("\\\\'{U}" "Ú")
|
|
287 ("\\\\^{U}" "Û")
|
|
288 ("\\\\~{n}" "ñ")
|
|
289 ("\\\\~{N}" "Ñ")
|
|
290 ("\\\\c{c}" "ç")
|
|
291 ("\\\\c{C}" "Ç")
|
|
292 ("{\\\\ss}" "ß")
|
|
293 ("?`" "¿")
|
|
294 ("!`" "¡")
|
|
295 ("{?`}" "¿")
|
|
296 ("{!`}" "¡")
|
|
297 )
|
|
298 "Translation table for translating TeX sequences to ISO 8859-1 characters.
|
|
299 This table is not exhaustive (and due to TeX's power can never be). It only
|
|
300 contains commonly used sequences.")
|
|
301
|
|
302 (defun iso-tex2iso ()
|
|
303 "Translate TeX sequences to ISO 8859-1 characters."
|
|
304 (interactive)
|
|
305 (iso-translate-conventions iso-tex2iso-trans-tab))
|
|
306
|
|
307 (defvar iso-gtex2iso-trans-tab
|
|
308 '(
|
|
309 ("\"a" "ä")
|
|
310 ("\"A" "Ä")
|
|
311 ("\"o" "ö")
|
|
312 ("\"O" "Ö")
|
|
313 ("\"u" "ü")
|
|
314 ("\"U" "Ü")
|
|
315 ("\"s" "ß")
|
|
316 ("\\\\3" "ß")
|
|
317 ("{\\\\\"a}" "ä")
|
|
318 ("{\\\\`a}" "à")
|
|
319 ("{\\\\'a}" "á")
|
|
320 ("{\\\\~a}" "ã")
|
|
321 ("{\\\\^a}" "â")
|
|
322 ("{\\\\\"e}" "ë")
|
|
323 ("{\\\\`e}" "è")
|
|
324 ("{\\\\'e}" "é")
|
|
325 ("{\\\\^e}" "ê")
|
|
326 ("{\\\\\"\\\\i}" "ï")
|
|
327 ("{\\\\`\\\\i}" "ì")
|
|
328 ("{\\\\'\\\\i}" "í")
|
|
329 ("{\\\\^\\\\i}" "î")
|
|
330 ("{\\\\\"i}" "ï")
|
|
331 ("{\\\\`i}" "ì")
|
|
332 ("{\\\\'i}" "í")
|
|
333 ("{\\\\^i}" "î")
|
|
334 ("{\\\\\"o}" "ö")
|
|
335 ("{\\\\`o}" "ò")
|
|
336 ("{\\\\'o}" "ó")
|
|
337 ("{\\\\~o}" "õ")
|
|
338 ("{\\\\^o}" "ô")
|
|
339 ("{\\\\\"u}" "ü")
|
|
340 ("{\\\\`u}" "ù")
|
|
341 ("{\\\\'u}" "ú")
|
|
342 ("{\\\\^u}" "û")
|
|
343 ("{\\\\\"A}" "Ä")
|
|
344 ("{\\\\`A}" "À")
|
|
345 ("{\\\\'A}" "Á")
|
|
346 ("{\\\\~A}" "Ã")
|
|
347 ("{\\\\^A}" "Â")
|
|
348 ("{\\\\\"E}" "Ë")
|
|
349 ("{\\\\`E}" "È")
|
|
350 ("{\\\\'E}" "É")
|
|
351 ("{\\\\^E}" "Ê")
|
|
352 ("{\\\\\"I}" "Ï")
|
|
353 ("{\\\\`I}" "Ì")
|
|
354 ("{\\\\'I}" "Í")
|
|
355 ("{\\\\^I}" "Î")
|
|
356 ("{\\\\\"O}" "Ö")
|
|
357 ("{\\\\`O}" "Ò")
|
|
358 ("{\\\\'O}" "Ó")
|
|
359 ("{\\\\~O}" "Õ")
|
|
360 ("{\\\\^O}" "Ô")
|
|
361 ("{\\\\\"U}" "Ü")
|
|
362 ("{\\\\`U}" "Ù")
|
|
363 ("{\\\\'U}" "Ú")
|
|
364 ("{\\\\^U}" "Û")
|
|
365 ("{\\\\~n}" "ñ")
|
|
366 ("{\\\\~N}" "Ñ")
|
|
367 ("{\\\\c c}" "ç")
|
|
368 ("{\\\\c C}" "Ç")
|
|
369 ("\\\\\"{a}" "ä")
|
|
370 ("\\\\`{a}" "à")
|
|
371 ("\\\\'{a}" "á")
|
|
372 ("\\\\~{a}" "ã")
|
|
373 ("\\\\^{a}" "â")
|
|
374 ("\\\\\"{e}" "ë")
|
|
375 ("\\\\`{e}" "è")
|
|
376 ("\\\\'{e}" "é")
|
|
377 ("\\\\^{e}" "ê")
|
|
378 ("\\\\\"{\\\\i}" "ï")
|
|
379 ("\\\\`{\\\\i}" "ì")
|
|
380 ("\\\\'{\\\\i}" "í")
|
|
381 ("\\\\^{\\\\i}" "î")
|
|
382 ("\\\\\"{i}" "ï")
|
|
383 ("\\\\`{i}" "ì")
|
|
384 ("\\\\'{i}" "í")
|
|
385 ("\\\\^{i}" "î")
|
|
386 ("\\\\\"{o}" "ö")
|
|
387 ("\\\\`{o}" "ò")
|
|
388 ("\\\\'{o}" "ó")
|
|
389 ("\\\\~{o}" "õ")
|
|
390 ("\\\\^{o}" "ô")
|
|
391 ("\\\\\"{u}" "ü")
|
|
392 ("\\\\`{u}" "ù")
|
|
393 ("\\\\'{u}" "ú")
|
|
394 ("\\\\^{u}" "û")
|
|
395 ("\\\\\"{A}" "Ä")
|
|
396 ("\\\\`{A}" "À")
|
|
397 ("\\\\'{A}" "Á")
|
|
398 ("\\\\~{A}" "Ã")
|
|
399 ("\\\\^{A}" "Â")
|
|
400 ("\\\\\"{E}" "Ë")
|
|
401 ("\\\\`{E}" "È")
|
|
402 ("\\\\'{E}" "É")
|
|
403 ("\\\\^{E}" "Ê")
|
|
404 ("\\\\\"{I}" "Ï")
|
|
405 ("\\\\`{I}" "Ì")
|
|
406 ("\\\\'{I}" "Í")
|
|
407 ("\\\\^{I}" "Î")
|
|
408 ("\\\\\"{O}" "Ö")
|
|
409 ("\\\\`{O}" "Ò")
|
|
410 ("\\\\'{O}" "Ó")
|
|
411 ("\\\\~{O}" "Õ")
|
|
412 ("\\\\^{O}" "Ô")
|
|
413 ("\\\\\"{U}" "Ü")
|
|
414 ("\\\\`{U}" "Ù")
|
|
415 ("\\\\'{U}" "Ú")
|
|
416 ("\\\\^{U}" "Û")
|
|
417 ("\\\\~{n}" "ñ")
|
|
418 ("\\\\~{N}" "Ñ")
|
|
419 ("\\\\c{c}" "ç")
|
|
420 ("\\\\c{C}" "Ç")
|
|
421 ("{\\\\ss}" "ß")
|
|
422 ("?`" "¿")
|
|
423 ("!`" "¡")
|
|
424 ("{?`}" "¿")
|
|
425 ("{!`}" "¡")
|
|
426 )
|
|
427 "Translation table for translating German TeX sequences to ISO 8859-1.
|
|
428 This table is not exhaustive (and due to TeX's power can never be). It only
|
|
429 contains commonly used sequences.")
|
|
430
|
|
431 (defvar iso-iso2gtex-trans-tab
|
|
432 '(
|
|
433 ("ä" "\"a")
|
|
434 ("à" "{\\\\`a}")
|
|
435 ("á" "{\\\\'a}")
|
|
436 ("ã" "{\\\\~a}")
|
|
437 ("â" "{\\\\^a}")
|
|
438 ("ë" "{\\\\\"e}")
|
|
439 ("è" "{\\\\`e}")
|
|
440 ("é" "{\\\\'e}")
|
|
441 ("ê" "{\\\\^e}")
|
|
442 ("ï" "{\\\\\"\\\\i}")
|
|
443 ("ì" "{\\\\`\\\\i}")
|
|
444 ("í" "{\\\\'\\\\i}")
|
|
445 ("î" "{\\\\^\\\\i}")
|
|
446 ("ö" "\"o")
|
|
447 ("ò" "{\\\\`o}")
|
|
448 ("ó" "{\\\\'o}")
|
|
449 ("õ" "{\\\\~o}")
|
|
450 ("ô" "{\\\\^o}")
|
|
451 ("ü" "\"u")
|
|
452 ("ù" "{\\\\`u}")
|
|
453 ("ú" "{\\\\'u}")
|
|
454 ("û" "{\\\\^u}")
|
|
455 ("Ä" "\"A")
|
|
456 ("À" "{\\\\`A}")
|
|
457 ("Á" "{\\\\'A}")
|
|
458 ("Ã" "{\\\\~A}")
|
|
459 ("Â" "{\\\\^A}")
|
|
460 ("Ë" "{\\\\\"E}")
|
|
461 ("È" "{\\\\`E}")
|
|
462 ("É" "{\\\\'E}")
|
|
463 ("Ê" "{\\\\^E}")
|
|
464 ("Ï" "{\\\\\"I}")
|
|
465 ("Ì" "{\\\\`I}")
|
|
466 ("Í" "{\\\\'I}")
|
|
467 ("Î" "{\\\\^I}")
|
|
468 ("Ö" "\"O")
|
|
469 ("Ò" "{\\\\`O}")
|
|
470 ("Ó" "{\\\\'O}")
|
|
471 ("Õ" "{\\\\~O}")
|
|
472 ("Ô" "{\\\\^O}")
|
|
473 ("Ü" "\"U")
|
|
474 ("Ù" "{\\\\`U}")
|
|
475 ("Ú" "{\\\\'U}")
|
|
476 ("Û" "{\\\\^U}")
|
|
477 ("ñ" "{\\\\~n}")
|
|
478 ("Ñ" "{\\\\~N}")
|
|
479 ("ç" "{\\\\c c}")
|
|
480 ("Ç" "{\\\\c C}")
|
|
481 ("ß" "\"s")
|
|
482 ("¿" "{?`}")
|
|
483 ("¡" "{!`}")
|
|
484 )
|
|
485 "Translation table for translating ISO 8859-1 characters to German TeX.")
|
|
486
|
|
487 (defun iso-gtex2iso ()
|
|
488 "Translate German TeX sequences to ISO 8859-1 characters."
|
|
489 (interactive)
|
|
490 (iso-translate-conventions iso-gtex2iso-trans-tab))
|
|
491
|
|
492
|
|
493 (defun iso-iso2gtex ()
|
|
494 "Translate ISO 8859-1 characters to German TeX sequences."
|
|
495 (interactive)
|
|
496 (iso-translate-conventions iso-iso2gtex-trans-tab))
|
|
497
|
|
498
|
|
499 (defun iso-german-tex-p ()
|
|
500 "Check if tex buffer is German LaTeX."
|
|
501 (save-excursion
|
|
502 (widen)
|
|
503 (goto-char (point-min))
|
|
504 (re-search-forward "\\\\documentstyle\\[.*german.*\\]" nil t)))
|
|
505
|
|
506 (defun iso-fix-iso2tex ()
|
|
507 "Turn ISO 8859-1 (aka. ISO Latin-1) buffer into TeX sequences.
|
|
508 If German TeX is used, German TeX sequences are generated."
|
|
509 (if (or (equal major-mode 'latex-mode)
|
|
510 (equal major-mode 'LaTeX-mode)) ; AucTeX wants this
|
|
511 (if (iso-german-tex-p)
|
|
512 (iso-iso2gtex)
|
|
513 (iso-iso2tex)))
|
|
514 (if (or (equal major-mode 'tex-mode)
|
|
515 (equal major-mode 'TeX-mode)) ; AucTeX wants this
|
|
516 (iso-iso2tex)))
|
|
517
|
|
518 (defun iso-fix-tex2iso ()
|
|
519 "Turn TeX sequences into ISO 8859-1 (aka. ISO Latin-1) characters.
|
|
520 This function recognices German TeX buffers."
|
|
521 (if (or (equal major-mode 'latex-mode)
|
|
522 (equal major-mode 'Latex-mode)) ; AucTeX wants this
|
|
523 (if (iso-german-tex-p)
|
|
524 (iso-gtex2iso)
|
|
525 (iso-tex2iso)))
|
|
526 (if (or (equal major-mode 'tex-mode)
|
|
527 (equal major-mode 'TeX-mode)) ;; AucTeX wants this
|
|
528 (iso-tex2iso)))
|
|
529
|
|
530 (defun iso-cvt-ffh ()
|
|
531 "find-file-hook for iso-cvt-cvt.el."
|
|
532 (iso-fix-tex2iso)
|
|
533 (set-buffer-modified-p nil))
|
|
534
|
|
535 (defun iso-cvt-wfh ()
|
|
536 "write file hook for iso-cvt-cvt.el."
|
|
537 (iso-fix-iso2tex))
|
|
538
|
|
539 (defun iso-cvt-ash ()
|
|
540 "after save hook for iso-cvt-cvt.el."
|
|
541 (iso-fix-tex2iso)
|
|
542 (set-buffer-modified-p nil))
|
|
543
|
|
544 (add-hook 'find-file-hooks 'iso-cvt-ffh)
|
|
545 (add-hook 'write-file-hooks 'iso-cvt-wfh)
|
|
546 (add-hook 'after-save-hook 'iso-cvt-ash)
|
|
547
|
|
548 ;;; iso-cvt.el ends here
|