]> code.delx.au - gnu-emacs/blob - lisp/international/iso-cvt.el
Require `format'.
[gnu-emacs] / lisp / international / iso-cvt.el
1 ;;; iso-cvt.-el -- translate ISO 8859-1 from/to various encodings
2 ;; This file was formerly called gm-lingo.el.
3
4 ;; Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
5
6 ;; Author: Michael Gschwind <mike@vlsivie.tuwien.ac.at>
7 ;; Keywords: tex, iso, latin, i18n
8
9 ;; This file is part of GNU Emacs.
10
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation; either version 2, or (at your option)
14 ;; any later version.
15
16 ;; GNU Emacs is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;; GNU General Public License for more details.
20
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
24 ;; Boston, MA 02111-1307, USA.
25
26 ;;; Commentary:
27 ;; This lisp code is a general framework for translating various
28 ;; representations of the same data.
29 ;; among other things it can be used to translate TeX, HTML, and compressed
30 ;; files to ISO 8859-1. It can also be used to translate different charsets
31 ;; such as IBM PC, Macintosh or HP Roman8.
32 ;; Note that many translations use the GNU recode tool to do the actual
33 ;; conversion. So you might want to install that tool to get the full
34 ;; benefit of iso-cvt.el
35 ;
36
37 ; TO DO:
38 ; Cover more cases for translation (There is an infinite number of ways to
39 ; represent accented characters in TeX)
40
41 ;; SEE ALSO:
42 ; If you are interested in questions related to using the ISO 8859-1
43 ; characters set (configuring emacs, Unix, etc. to use ISO), then you
44 ; can get the ISO 8859-1 FAQ via anonymous ftp from
45 ; ftp.vlsivie.tuwien.ac.at in /pub/bit/FAQ-ISO-8859-1
46
47 ;;; Code:
48
49 (provide 'iso-cvt)
50 (require 'format)
51
52 (defvar iso-spanish-trans-tab
53 '(
54 ("~n" "ñ")
55 ("\([a-zA-Z]\)#" "\\1ñ")
56 ("~N" "Ñ")
57 ("\\([-a-zA-Z\"`]\\)\"u" "\\1ü")
58 ("\\([-a-zA-Z\"`]\\)\"U" "\\1Ü")
59 ("\\([-a-zA-Z]\\)'o" "\\1ó")
60 ("\\([-a-zA-Z]\\)'O" "\\Ó")
61 ("\\([-a-zA-Z]\\)'e" "\\1é")
62 ("\\([-a-zA-Z]\\)'E" "\\1É")
63 ("\\([-a-zA-Z]\\)'a" "\\1á")
64 ("\\([-a-zA-Z]\\)'A" "\\1A")
65 ("\\([-a-zA-Z]\\)'i" "\\1í")
66 ("\\([-a-zA-Z]\\)'I" "\\1Í")
67 )
68 "Spanish translation table.")
69
70 (defun iso-translate-conventions (from to trans-tab)
71 "Use the translation table TRANS-TAB to translate the current buffer."
72 (save-excursion
73 (save-restriction
74 (narrow-to-region from to)
75 (goto-char from)
76 (let ((work-tab trans-tab)
77 (buffer-read-only nil)
78 (case-fold-search nil))
79 (while work-tab
80 (save-excursion
81 (let ((trans-this (car work-tab)))
82 (while (re-search-forward (car trans-this) nil t)
83 (replace-match (car (cdr trans-this)) t nil)))
84 (setq work-tab (cdr work-tab)))))
85 (point-max))))
86
87 (defun iso-spanish (from to)
88 "Translate net conventions for Spanish to ISO 8859-1."
89 (interactive)
90 (iso-translate-conventions from to iso-spanish-trans-tab))
91
92 (defvar iso-aggressive-german-trans-tab
93 '(
94 ("\"a" "ä")
95 ("\"A" "Ä")
96 ("\"o" "ö")
97 ("\"O" "Ö")
98 ("\"u" "ü")
99 ("\"U" "Ü")
100 ("\"s" "ß")
101 ("\\\\3" "ß")
102 )
103 "German translation table.
104 This table uses an aggressive translation approach and may erroneously
105 translate too much.")
106
107 (defvar iso-conservative-german-trans-tab
108 '(
109 ("\\([-a-zA-Z\"`]\\)\"a" "\\1ä")
110 ("\\([-a-zA-Z\"`]\\)\"A" "\\1Ä")
111 ("\\([-a-zA-Z\"`]\\)\"o" "\\1ö")
112 ("\\([-a-zA-Z\"`]\\)\"O" "\\1Ö")
113 ("\\([-a-zA-Z\"`]\\)\"u" "\\1ü")
114 ("\\([-a-zA-Z\"`]\\)\"U" "\\1Ü")
115 ("\\([-a-zA-Z\"`]\\)\"s" "\\1ß")
116 ("\\([-a-zA-Z\"`]\\)\\\\3" "\\1ß")
117 )
118 "German translation table.
119 This table uses a conservative translation approach and may translate too
120 little.")
121
122
123 (defvar iso-german-trans-tab iso-aggressive-german-trans-tab
124 "Currently active translation table for German.")
125
126 (defun iso-german (from to)
127 "Translate net conventions for German to ISO 8859-1."
128 (interactive)
129 (iso-translate-conventions from to iso-german-trans-tab))
130
131 (defvar iso-iso2tex-trans-tab
132 '(
133 ("ä" "{\\\\\"a}")
134 ("à" "{\\\\`a}")
135 ("á" "{\\\\'a}")
136 ("ã" "{\\\\~a}")
137 ("â" "{\\\\^a}")
138 ("ë" "{\\\\\"e}")
139 ("è" "{\\\\`e}")
140 ("é" "{\\\\'e}")
141 ("ê" "{\\\\^e}")
142 ("ï" "{\\\\\"\\\\i}")
143 ("ì" "{\\\\`\\\\i}")
144 ("í" "{\\\\'\\\\i}")
145 ("î" "{\\\\^\\\\i}")
146 ("ö" "{\\\\\"o}")
147 ("ò" "{\\\\`o}")
148 ("ó" "{\\\\'o}")
149 ("õ" "{\\\\~o}")
150 ("ô" "{\\\\^o}")
151 ("ü" "{\\\\\"u}")
152 ("ù" "{\\\\`u}")
153 ("ú" "{\\\\'u}")
154 ("û" "{\\\\^u}")
155 ("Ä" "{\\\\\"A}")
156 ("À" "{\\\\`A}")
157 ("Á" "{\\\\'A}")
158 ("Ã" "{\\\\~A}")
159 ("Â" "{\\\\^A}")
160 ("Ë" "{\\\\\"E}")
161 ("È" "{\\\\`E}")
162 ("É" "{\\\\'E}")
163 ("Ê" "{\\\\^E}")
164 ("Ï" "{\\\\\"I}")
165 ("Ì" "{\\\\`I}")
166 ("Í" "{\\\\'I}")
167 ("Î" "{\\\\^I}")
168 ("Ö" "{\\\\\"O}")
169 ("Ò" "{\\\\`O}")
170 ("Ó" "{\\\\'O}")
171 ("Õ" "{\\\\~O}")
172 ("Ô" "{\\\\^O}")
173 ("Ü" "{\\\\\"U}")
174 ("Ù" "{\\\\`U}")
175 ("Ú" "{\\\\'U}")
176 ("Û" "{\\\\^U}")
177 ("ñ" "{\\\\~n}")
178 ("Ñ" "{\\\\~N}")
179 ("ç" "{\\\\c c}")
180 ("Ç" "{\\\\c C}")
181 ("ß" "{\\\\ss}")
182 ("\306" "{\\\\AE}")
183 ("\346" "{\\\\ae}")
184 ("\305" "{\\\\AA}")
185 ("\345" "{\\\\aa}")
186 ("\251" "{\\\\copyright}")
187 ("£" "{\\\\pounds}")
188 ("¶" "{\\\\P}")
189 ("§" "{\\\\S}")
190 ("¿" "{?`}")
191 ("¡" "{!`}")
192 )
193 "Translation table for translating ISO 8859-1 characters to TeX sequences.")
194
195
196
197
198 (defun iso-iso2tex (from to)
199 "Translate ISO 8859-1 characters to TeX sequences."
200 (interactive)
201 (iso-translate-conventions from to iso-iso2tex-trans-tab))
202
203
204 (defvar iso-tex2iso-trans-tab
205 '(
206 ("{\\\\\"a}" "ä")
207 ("{\\\\`a}" "à")
208 ("{\\\\'a}" "á")
209 ("{\\\\~a}" "ã")
210 ("{\\\\^a}" "â")
211 ("{\\\\\"e}" "ë")
212 ("{\\\\`e}" "è")
213 ("{\\\\'e}" "é")
214 ("{\\\\^e}" "ê")
215 ("{\\\\\"\\\\i}" "ï")
216 ("{\\\\`\\\\i}" "ì")
217 ("{\\\\'\\\\i}" "í")
218 ("{\\\\^\\\\i}" "î")
219 ("{\\\\\"i}" "ï")
220 ("{\\\\`i}" "ì")
221 ("{\\\\'i}" "í")
222 ("{\\\\^i}" "î")
223 ("{\\\\\"o}" "ö")
224 ("{\\\\`o}" "ò")
225 ("{\\\\'o}" "ó")
226 ("{\\\\~o}" "õ")
227 ("{\\\\^o}" "ô")
228 ("{\\\\\"u}" "ü")
229 ("{\\\\`u}" "ù")
230 ("{\\\\'u}" "ú")
231 ("{\\\\^u}" "û")
232 ("{\\\\\"A}" "Ä")
233 ("{\\\\`A}" "À")
234 ("{\\\\'A}" "Á")
235 ("{\\\\~A}" "Ã")
236 ("{\\\\^A}" "Â")
237 ("{\\\\\"E}" "Ë")
238 ("{\\\\`E}" "È")
239 ("{\\\\'E}" "É")
240 ("{\\\\^E}" "Ê")
241 ("{\\\\\"I}" "Ï")
242 ("{\\\\`I}" "Ì")
243 ("{\\\\'I}" "Í")
244 ("{\\\\^I}" "Î")
245 ("{\\\\\"O}" "Ö")
246 ("{\\\\`O}" "Ò")
247 ("{\\\\'O}" "Ó")
248 ("{\\\\~O}" "Õ")
249 ("{\\\\^O}" "Ô")
250 ("{\\\\\"U}" "Ü")
251 ("{\\\\`U}" "Ù")
252 ("{\\\\'U}" "Ú")
253 ("{\\\\^U}" "Û")
254 ("{\\\\~n}" "ñ")
255 ("{\\\\~N}" "Ñ")
256 ("{\\\\c c}" "ç")
257 ("{\\\\c C}" "Ç")
258 ("\\\\\"a" "ä")
259 ("\\\\`a" "à")
260 ("\\\\'a" "á")
261 ("\\\\~a" "ã")
262 ("\\\\^a" "â")
263 ("\\\\\"e" "ë")
264 ("\\\\`e" "è")
265 ("\\\\'e" "é")
266 ("\\\\^e" "ê")
267 ("\\\\\"\\\\i" "ï")
268 ("\\\\`\\\\i" "ì")
269 ("\\\\'\\\\i" "í")
270 ("\\\\^\\\\i" "î")
271 ("\\\\\"i" "ï")
272 ("\\\\`i" "ì")
273 ("\\\\'i" "í")
274 ("\\\\^i" "î")
275 ("\\\\\"o" "ö")
276 ("\\\\`o" "ò")
277 ("\\\\'o" "ó")
278 ("\\\\~o" "õ")
279 ("\\\\^o" "ô")
280 ("\\\\\"u" "ü")
281 ("\\\\`u" "ù")
282 ("\\\\'u" "ú")
283 ("\\\\^u" "û")
284 ("\\\\\"A" "Ä")
285 ("\\\\`A" "À")
286 ("\\\\'A" "Á")
287 ("\\\\~A" "Ã")
288 ("\\\\^A" "Â")
289 ("\\\\\"E" "Ë")
290 ("\\\\`E" "È")
291 ("\\\\'E" "É")
292 ("\\\\^E" "Ê")
293 ("\\\\\"I" "Ï")
294 ("\\\\`I" "Ì")
295 ("\\\\'I" "Í")
296 ("\\\\^I" "Î")
297 ("\\\\\"O" "Ö")
298 ("\\\\`O" "Ò")
299 ("\\\\'O" "Ó")
300 ("\\\\~O" "Õ")
301 ("\\\\^O" "Ô")
302 ("\\\\\"U" "Ü")
303 ("\\\\`U" "Ù")
304 ("\\\\'U" "Ú")
305 ("\\\\^U" "Û")
306 ("\\\\~n" "ñ")
307 ("\\\\~N" "Ñ")
308 ("\\\\\"{a}" "ä")
309 ("\\\\`{a}" "à")
310 ("\\\\'{a}" "á")
311 ("\\\\~{a}" "ã")
312 ("\\\\^{a}" "â")
313 ("\\\\\"{e}" "ë")
314 ("\\\\`{e}" "è")
315 ("\\\\'{e}" "é")
316 ("\\\\^{e}" "ê")
317 ("\\\\\"{\\\\i}" "ï")
318 ("\\\\`{\\\\i}" "ì")
319 ("\\\\'{\\\\i}" "í")
320 ("\\\\^{\\\\i}" "î")
321 ("\\\\\"{i}" "ï")
322 ("\\\\`{i}" "ì")
323 ("\\\\'{i}" "í")
324 ("\\\\^{i}" "î")
325 ("\\\\\"{o}" "ö")
326 ("\\\\`{o}" "ò")
327 ("\\\\'{o}" "ó")
328 ("\\\\~{o}" "õ")
329 ("\\\\^{o}" "ô")
330 ("\\\\\"{u}" "ü")
331 ("\\\\`{u}" "ù")
332 ("\\\\'{u}" "ú")
333 ("\\\\^{u}" "û")
334 ("\\\\\"{A}" "Ä")
335 ("\\\\`{A}" "À")
336 ("\\\\'{A}" "Á")
337 ("\\\\~{A}" "Ã")
338 ("\\\\^{A}" "Â")
339 ("\\\\\"{E}" "Ë")
340 ("\\\\`{E}" "È")
341 ("\\\\'{E}" "É")
342 ("\\\\^{E}" "Ê")
343 ("\\\\\"{I}" "Ï")
344 ("\\\\`{I}" "Ì")
345 ("\\\\'{I}" "Í")
346 ("\\\\^{I}" "Î")
347 ("\\\\\"{O}" "Ö")
348 ("\\\\`{O}" "Ò")
349 ("\\\\'{O}" "Ó")
350 ("\\\\~{O}" "Õ")
351 ("\\\\^{O}" "Ô")
352 ("\\\\\"{U}" "Ü")
353 ("\\\\`{U}" "Ù")
354 ("\\\\'{U}" "Ú")
355 ("\\\\^{U}" "Û")
356 ("\\\\~{n}" "ñ")
357 ("\\\\~{N}" "Ñ")
358 ("\\\\c{c}" "ç")
359 ("\\\\c{C}" "Ç")
360 ("{\\\\ss}" "ß")
361 ("{\\\\AE}" "\306")
362 ("{\\\\ae}" "\346")
363 ("{\\\\AA}" "\305")
364 ("{\\\\aa}" "\345")
365 ("{\\\\copyright}" "\251")
366 ("\\\\copyright{}" "\251")
367 ("{\\\\pounds}" "£" )
368 ("{\\\\P}" "¶" )
369 ("{\\\\S}" "§" )
370 ("\\\\pounds{}" "£" )
371 ("\\\\P{}" "¶" )
372 ("\\\\S{}" "§" )
373 ("{\\?`}" "¿")
374 ("{!`}" "¡")
375 ("\\?`" "¿")
376 ("!`" "¡")
377 )
378 "Translation table for translating TeX sequences to ISO 8859-1 characters.
379 This table is not exhaustive (and due to TeX's power can never be). It only
380 contains commonly used sequences.")
381
382 (defun iso-tex2iso (from to)
383 "Translate TeX sequences to ISO 8859-1 characters."
384 (interactive)
385 (iso-translate-conventions from to iso-tex2iso-trans-tab))
386
387 (defvar iso-gtex2iso-trans-tab
388 '(
389 ("{\\\\\"a}" "ä")
390 ("{\\\\`a}" "à")
391 ("{\\\\'a}" "á")
392 ("{\\\\~a}" "ã")
393 ("{\\\\^a}" "â")
394 ("{\\\\\"e}" "ë")
395 ("{\\\\`e}" "è")
396 ("{\\\\'e}" "é")
397 ("{\\\\^e}" "ê")
398 ("{\\\\\"\\\\i}" "ï")
399 ("{\\\\`\\\\i}" "ì")
400 ("{\\\\'\\\\i}" "í")
401 ("{\\\\^\\\\i}" "î")
402 ("{\\\\\"i}" "ï")
403 ("{\\\\`i}" "ì")
404 ("{\\\\'i}" "í")
405 ("{\\\\^i}" "î")
406 ("{\\\\\"o}" "ö")
407 ("{\\\\`o}" "ò")
408 ("{\\\\'o}" "ó")
409 ("{\\\\~o}" "õ")
410 ("{\\\\^o}" "ô")
411 ("{\\\\\"u}" "ü")
412 ("{\\\\`u}" "ù")
413 ("{\\\\'u}" "ú")
414 ("{\\\\^u}" "û")
415 ("{\\\\\"A}" "Ä")
416 ("{\\\\`A}" "À")
417 ("{\\\\'A}" "Á")
418 ("{\\\\~A}" "Ã")
419 ("{\\\\^A}" "Â")
420 ("{\\\\\"E}" "Ë")
421 ("{\\\\`E}" "È")
422 ("{\\\\'E}" "É")
423 ("{\\\\^E}" "Ê")
424 ("{\\\\\"I}" "Ï")
425 ("{\\\\`I}" "Ì")
426 ("{\\\\'I}" "Í")
427 ("{\\\\^I}" "Î")
428 ("{\\\\\"O}" "Ö")
429 ("{\\\\`O}" "Ò")
430 ("{\\\\'O}" "Ó")
431 ("{\\\\~O}" "Õ")
432 ("{\\\\^O}" "Ô")
433 ("{\\\\\"U}" "Ü")
434 ("{\\\\`U}" "Ù")
435 ("{\\\\'U}" "Ú")
436 ("{\\\\^U}" "Û")
437 ("{\\\\~n}" "ñ")
438 ("{\\\\~N}" "Ñ")
439 ("{\\\\c c}" "ç")
440 ("{\\\\c C}" "Ç")
441 ("\\\\\"a" "ä")
442 ("\\\\`a" "à")
443 ("\\\\'a" "á")
444 ("\\\\~a" "ã")
445 ("\\\\^a" "â")
446 ("\\\\\"e" "ë")
447 ("\\\\`e" "è")
448 ("\\\\'e" "é")
449 ("\\\\^e" "ê")
450 ("\\\\\"\\\\i" "ï")
451 ("\\\\`\\\\i" "ì")
452 ("\\\\'\\\\i" "í")
453 ("\\\\^\\\\i" "î")
454 ("\\\\\"i" "ï")
455 ("\\\\`i" "ì")
456 ("\\\\'i" "í")
457 ("\\\\^i" "î")
458 ("\\\\\"o" "ö")
459 ("\\\\`o" "ò")
460 ("\\\\'o" "ó")
461 ("\\\\~o" "õ")
462 ("\\\\^o" "ô")
463 ("\\\\\"u" "ü")
464 ("\\\\`u" "ù")
465 ("\\\\'u" "ú")
466 ("\\\\^u" "û")
467 ("\\\\\"A" "Ä")
468 ("\\\\`A" "À")
469 ("\\\\'A" "Á")
470 ("\\\\~A" "Ã")
471 ("\\\\^A" "Â")
472 ("\\\\\"E" "Ë")
473 ("\\\\`E" "È")
474 ("\\\\'E" "É")
475 ("\\\\^E" "Ê")
476 ("\\\\\"I" "Ï")
477 ("\\\\`I" "Ì")
478 ("\\\\'I" "Í")
479 ("\\\\^I" "Î")
480 ("\\\\\"O" "Ö")
481 ("\\\\`O" "Ò")
482 ("\\\\'O" "Ó")
483 ("\\\\~O" "Õ")
484 ("\\\\^O" "Ô")
485 ("\\\\\"U" "Ü")
486 ("\\\\`U" "Ù")
487 ("\\\\'U" "Ú")
488 ("\\\\^U" "Û")
489 ("\\\\~n" "ñ")
490 ("\\\\~N" "Ñ")
491 ("\\\\\"{a}" "ä")
492 ("\\\\`{a}" "à")
493 ("\\\\'{a}" "á")
494 ("\\\\~{a}" "ã")
495 ("\\\\^{a}" "â")
496 ("\\\\\"{e}" "ë")
497 ("\\\\`{e}" "è")
498 ("\\\\'{e}" "é")
499 ("\\\\^{e}" "ê")
500 ("\\\\\"{\\\\i}" "ï")
501 ("\\\\`{\\\\i}" "ì")
502 ("\\\\'{\\\\i}" "í")
503 ("\\\\^{\\\\i}" "î")
504 ("\\\\\"{i}" "ï")
505 ("\\\\`{i}" "ì")
506 ("\\\\'{i}" "í")
507 ("\\\\^{i}" "î")
508 ("\\\\\"{o}" "ö")
509 ("\\\\`{o}" "ò")
510 ("\\\\'{o}" "ó")
511 ("\\\\~{o}" "õ")
512 ("\\\\^{o}" "ô")
513 ("\\\\\"{u}" "ü")
514 ("\\\\`{u}" "ù")
515 ("\\\\'{u}" "ú")
516 ("\\\\^{u}" "û")
517 ("\\\\\"{A}" "Ä")
518 ("\\\\`{A}" "À")
519 ("\\\\'{A}" "Á")
520 ("\\\\~{A}" "Ã")
521 ("\\\\^{A}" "Â")
522 ("\\\\\"{E}" "Ë")
523 ("\\\\`{E}" "È")
524 ("\\\\'{E}" "É")
525 ("\\\\^{E}" "Ê")
526 ("\\\\\"{I}" "Ï")
527 ("\\\\`{I}" "Ì")
528 ("\\\\'{I}" "Í")
529 ("\\\\^{I}" "Î")
530 ("\\\\\"{O}" "Ö")
531 ("\\\\`{O}" "Ò")
532 ("\\\\'{O}" "Ó")
533 ("\\\\~{O}" "Õ")
534 ("\\\\^{O}" "Ô")
535 ("\\\\\"{U}" "Ü")
536 ("\\\\`{U}" "Ù")
537 ("\\\\'{U}" "Ú")
538 ("\\\\^{U}" "Û")
539 ("\\\\~{n}" "ñ")
540 ("\\\\~{N}" "Ñ")
541 ("\\\\c{c}" "ç")
542 ("\\\\c{C}" "Ç")
543 ("{\\\\ss}" "ß")
544 ("{\\\\AE}" "\306")
545 ("{\\\\ae}" "\346")
546 ("{\\\\AA}" "\305")
547 ("{\\\\aa}" "\345")
548 ("{\\\\copyright}" "\251")
549 ("\\\\copyright{}" "\251")
550 ("{\\\\pounds}" "£" )
551 ("{\\\\P}" "¶" )
552 ("{\\\\S}" "§" )
553 ("\\\\pounds{}" "£" )
554 ("\\\\P{}" "¶" )
555 ("\\\\S{}" "§" )
556 ("?`" "¿")
557 ("!`" "¡")
558 ("{?`}" "¿")
559 ("{!`}" "¡")
560 ("\"a" "ä")
561 ("\"A" "Ä")
562 ("\"o" "ö")
563 ("\"O" "Ö")
564 ("\"u" "ü")
565 ("\"U" "Ü")
566 ("\"s" "ß")
567 ("\\\\3" "ß")
568 )
569 "Translation table for translating German TeX sequences to ISO 8859-1.
570 This table is not exhaustive (and due to TeX's power can never be). It only
571 contains commonly used sequences.")
572
573 (defvar iso-iso2gtex-trans-tab
574 '(
575 ("ä" "\"a")
576 ("à" "{\\\\`a}")
577 ("á" "{\\\\'a}")
578 ("ã" "{\\\\~a}")
579 ("â" "{\\\\^a}")
580 ("ë" "{\\\\\"e}")
581 ("è" "{\\\\`e}")
582 ("é" "{\\\\'e}")
583 ("ê" "{\\\\^e}")
584 ("ï" "{\\\\\"\\\\i}")
585 ("ì" "{\\\\`\\\\i}")
586 ("í" "{\\\\'\\\\i}")
587 ("î" "{\\\\^\\\\i}")
588 ("ö" "\"o")
589 ("ò" "{\\\\`o}")
590 ("ó" "{\\\\'o}")
591 ("õ" "{\\\\~o}")
592 ("ô" "{\\\\^o}")
593 ("ü" "\"u")
594 ("ù" "{\\\\`u}")
595 ("ú" "{\\\\'u}")
596 ("û" "{\\\\^u}")
597 ("Ä" "\"A")
598 ("À" "{\\\\`A}")
599 ("Á" "{\\\\'A}")
600 ("Ã" "{\\\\~A}")
601 ("Â" "{\\\\^A}")
602 ("Ë" "{\\\\\"E}")
603 ("È" "{\\\\`E}")
604 ("É" "{\\\\'E}")
605 ("Ê" "{\\\\^E}")
606 ("Ï" "{\\\\\"I}")
607 ("Ì" "{\\\\`I}")
608 ("Í" "{\\\\'I}")
609 ("Î" "{\\\\^I}")
610 ("Ö" "\"O")
611 ("Ò" "{\\\\`O}")
612 ("Ó" "{\\\\'O}")
613 ("Õ" "{\\\\~O}")
614 ("Ô" "{\\\\^O}")
615 ("Ü" "\"U")
616 ("Ù" "{\\\\`U}")
617 ("Ú" "{\\\\'U}")
618 ("Û" "{\\\\^U}")
619 ("ñ" "{\\\\~n}")
620 ("Ñ" "{\\\\~N}")
621 ("ç" "{\\\\c c}")
622 ("Ç" "{\\\\c C}")
623 ("ß" "\"s")
624 ("\306" "{\\\\AE}")
625 ("\346" "{\\\\ae}")
626 ("\305" "{\\\\AA}")
627 ("\345" "{\\\\aa}")
628 ("\251" "{\\\\copyright}")
629 ("£" "{\\\\pounds}")
630 ("¶" "{\\\\P}")
631 ("§" "{\\\\S}")
632 ("¿" "{?`}")
633 ("¡" "{!`}")
634 )
635 "Translation table for translating ISO 8859-1 characters to German TeX.")
636
637 (defun iso-gtex2iso (from to)
638 "Translate German TeX sequences to ISO 8859-1 characters."
639 (interactive)
640 (iso-translate-conventions from to iso-gtex2iso-trans-tab))
641
642
643 (defun iso-iso2gtex (from to)
644 "Translate ISO 8859-1 characters to German TeX sequences."
645 (interactive)
646 (iso-translate-conventions from to iso-iso2gtex-trans-tab))
647
648 (defvar iso-iso2duden-trans-tab
649 '(("ä" "ae")
650 ("Ä" "Ae")
651 ("ö" "oe")
652 ("Ö" "Oe")
653 ("ü" "ue")
654 ("Ü" "Ue")
655 ("ß" "ss")))
656
657 (defun iso-iso2duden (from to)
658 "Translate ISO 8859-1 characters to German TeX sequences."
659 (interactive)
660 (iso-translate-conventions from to iso-iso2duden-trans-tab))
661
662 (defun iso-cvt-read-only ()
663 (interactive)
664 (error "This format is read-only; specify another format for writing"))
665
666 (defun iso-cvt-write-only ()
667 (interactive)
668 (error "This format is write-only"))
669
670 (defun iso-cvt-define-menu ()
671 "Add submenus to the Files menu, to convert to and from various formats."
672 (interactive)
673
674 (define-key menu-bar-files-menu [load-as-separator] '("--"))
675
676 (define-key menu-bar-files-menu [load-as] '("Load As..." . load-as))
677 (defvar load-as-menu-map (make-sparse-keymap "Load As..."))
678 (fset 'load-as load-as-menu-map)
679
680 ;;(define-key menu-bar-files-menu [insert-as] '("Insert As..." . insert-as))
681 (defvar insert-as-menu-map (make-sparse-keymap "Insert As..."))
682 (fset 'insert-as insert-as-menu-map)
683
684 (define-key menu-bar-files-menu [write-as] '("Write As..." . write-as))
685 (defvar write-as-menu-map (make-sparse-keymap "Write As..."))
686 (fset 'write-as write-as-menu-map)
687
688 (define-key menu-bar-files-menu [translate-separator] '("--"))
689
690 (define-key menu-bar-files-menu [translate-to] '("Translate to..." . translate-to))
691 (defvar translate-to-menu-map (make-sparse-keymap "Translate to..."))
692 (fset 'translate-to translate-to-menu-map)
693
694 (define-key menu-bar-files-menu [translate-from] '("Translate from..." . translate-from))
695 (defvar translate-from-menu-map (make-sparse-keymap "Translate from..."))
696 (fset 'translate-from translate-from-menu-map)
697
698 (let ((file-types (reverse format-alist))
699 name
700 str-name)
701 (while file-types
702 (setq name (car (car file-types))
703 str-name (car (cdr (car file-types)))
704 file-types (cdr file-types))
705 (if (stringp str-name)
706 (progn
707 (define-key load-as-menu-map (vector name)
708 (cons str-name
709 (list 'lambda '(file) (list 'interactive (format "FFind file (as %s): " name))
710 (list 'format-find-file 'file (list 'quote name)))))
711 (define-key insert-as-menu-map (vector name)
712 (cons str-name
713 (list 'lambda '(file) (list 'interactive (format "FInsert file (as %s): " name))
714 (list 'format-insert-file 'file (list 'quote name)))))
715 (define-key write-as-menu-map (vector name)
716 (cons str-name
717 (list 'lambda '(file) (list 'interactive (format "FWrite file (as %s): " name))
718 (list 'format-write-file 'file (list 'quote (list name))))))
719 (define-key translate-to-menu-map (vector name)
720 (cons str-name
721 (list 'lambda '() '(interactive)
722 (list 'format-encode-buffer (list 'quote name)))))
723 (define-key translate-from-menu-map (vector name)
724 (cons str-name
725 (list 'lambda '() '(interactive)
726 (list 'format-decode-buffer (list 'quote (list name))))))
727 )))))
728
729 ;;; iso-cvt.el ends here