(cvs-mode-add-change-log-entry-other-window):
[emacs.git] / lisp / international / iso-cvt.el
blob8ea455b678ff297ba3d7550cfbc6ccde582a813d
1 ;;; iso-cvt.-el -- translate ISO 8859-1 from/to various encodings -*- coding: iso-latin-1 -*-
2 ;; This file was formerly called gm-lingo.el.
4 ;; Copyright (C) 1993, 1994, 1995, 1996, 1998, 2000 Free Software Foundation, Inc.
6 ;; Author: Michael Gschwind <mike@vlsivie.tuwien.ac.at>
7 ;; Keywords: tex, iso, latin, i18n
9 ;; This file is part of GNU Emacs.
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.
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.
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.
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
36 ; TO DO:
37 ; Cover more cases for translation. (There is an infinite number of ways to
38 ; represent accented characters in TeX)
40 ;; SEE ALSO:
41 ; If you are interested in questions related to using the ISO 8859-1
42 ; characters set (configuring emacs, Unix, etc. to use ISO), then you
43 ; can get the ISO 8859-1 FAQ via anonymous ftp from
44 ; ftp.vlsivie.tuwien.ac.at in /pub/8bit/FAQ-ISO-8859-1
46 ;;; Code:
48 (defvar iso-spanish-trans-tab
50 ("~n" "ñ")
51 ("\([a-zA-Z]\)#" "\\1ñ")
52 ("~N" "Ñ")
53 ("\\([-a-zA-Z\"`]\\)\"u" "\\1ü")
54 ("\\([-a-zA-Z\"`]\\)\"U" "\\1Ü")
55 ("\\([-a-zA-Z]\\)'o" "\\1ó")
56 ("\\([-a-zA-Z]\\)'O" "\\Ó")
57 ("\\([-a-zA-Z]\\)'e" "\\1é")
58 ("\\([-a-zA-Z]\\)'E" "\\1É")
59 ("\\([-a-zA-Z]\\)'a" "\\1á")
60 ("\\([-a-zA-Z]\\)'A" "\\1A")
61 ("\\([-a-zA-Z]\\)'i" "\\1í")
62 ("\\([-a-zA-Z]\\)'I" "\\1Í")
64 "Spanish translation table.")
66 (defun iso-translate-conventions (from to trans-tab)
67 "Use the translation table TRANS-TAB to translate the current buffer."
68 (save-excursion
69 (save-restriction
70 (narrow-to-region from to)
71 (goto-char from)
72 (let ((work-tab trans-tab)
73 (buffer-read-only nil)
74 (case-fold-search nil))
75 (while work-tab
76 (save-excursion
77 (let ((trans-this (car work-tab)))
78 (while (re-search-forward (car trans-this) nil t)
79 (replace-match (car (cdr trans-this)) t nil)))
80 (setq work-tab (cdr work-tab)))))
81 (point-max))))
83 ;;;###autoload
84 (defun iso-spanish (from to &optional buffer)
85 "Translate net conventions for Spanish to ISO 8859-1.
86 The region between FROM and TO is translated using the table TRANS-TAB.
87 Optional arg BUFFER is ignored (so that the function can can be used in
88 `format-alist')."
89 (interactive "*r")
90 (iso-translate-conventions from to iso-spanish-trans-tab))
92 (defvar iso-aggressive-german-trans-tab
94 ("\"a" "ä")
95 ("\"A" "Ä")
96 ("\"o" "ö")
97 ("\"O" "Ö")
98 ("\"u" "ü")
99 ("\"U" "Ü")
100 ("\"s" "ß")
101 ("\\\\3" "ß")
103 "German translation table.
104 This table uses an aggressive translation approach and may erroneously
105 translate too much.")
107 (defvar iso-conservative-german-trans-tab
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ß")
118 "German translation table.
119 This table uses a conservative translation approach and may translate too
120 little.")
122 (defvar iso-german-trans-tab iso-aggressive-german-trans-tab
123 "Currently active translation table for German.")
125 ;;;###autoload
126 (defun iso-german (from to &optional buffer)
127 "Translate net conventions for German to ISO 8859-1.
128 The region between FROM and TO is translated using the table TRANS-TAB.
129 Optional arg BUFFER is ignored (so that the function can can be used in
130 `format-alist')."
131 (interactive "*r")
132 (iso-translate-conventions from to iso-german-trans-tab))
134 (defvar iso-iso2tex-trans-tab
136 ("ä" "{\\\\\"a}")
137 ("à" "{\\\\`a}")
138 ("á" "{\\\\'a}")
139 ("ã" "{\\\\~a}")
140 ("â" "{\\\\^a}")
141 ("ë" "{\\\\\"e}")
142 ("è" "{\\\\`e}")
143 ("é" "{\\\\'e}")
144 ("ê" "{\\\\^e}")
145 ("ï" "{\\\\\"\\\\i}")
146 ("ì" "{\\\\`\\\\i}")
147 ("í" "{\\\\'\\\\i}")
148 ("î" "{\\\\^\\\\i}")
149 ("ö" "{\\\\\"o}")
150 ("ò" "{\\\\`o}")
151 ("ó" "{\\\\'o}")
152 ("õ" "{\\\\~o}")
153 ("ô" "{\\\\^o}")
154 ("ü" "{\\\\\"u}")
155 ("ù" "{\\\\`u}")
156 ("ú" "{\\\\'u}")
157 ("û" "{\\\\^u}")
158 ("Ä" "{\\\\\"A}")
159 ("À" "{\\\\`A}")
160 ("Á" "{\\\\'A}")
161 ("Ã" "{\\\\~A}")
162 ("Â" "{\\\\^A}")
163 ("Ë" "{\\\\\"E}")
164 ("È" "{\\\\`E}")
165 ("É" "{\\\\'E}")
166 ("Ê" "{\\\\^E}")
167 ("Ï" "{\\\\\"I}")
168 ("Ì" "{\\\\`I}")
169 ("Í" "{\\\\'I}")
170 ("Î" "{\\\\^I}")
171 ("Ö" "{\\\\\"O}")
172 ("Ò" "{\\\\`O}")
173 ("Ó" "{\\\\'O}")
174 ("Õ" "{\\\\~O}")
175 ("Ô" "{\\\\^O}")
176 ("Ü" "{\\\\\"U}")
177 ("Ù" "{\\\\`U}")
178 ("Ú" "{\\\\'U}")
179 ("Û" "{\\\\^U}")
180 ("ñ" "{\\\\~n}")
181 ("Ñ" "{\\\\~N}")
182 ("ç" "{\\\\c c}")
183 ("Ç" "{\\\\c C}")
184 ("ß" "{\\\\ss}")
185 ("\306" "{\\\\AE}")
186 ("\346" "{\\\\ae}")
187 ("\305" "{\\\\AA}")
188 ("\345" "{\\\\aa}")
189 ("\251" "{\\\\copyright}")
190 ("£" "{\\\\pounds}")
191 ("¶" "{\\\\P}")
192 ("§" "{\\\\S}")
193 ("¿" "{?`}")
194 ("¡" "{!`}")
196 "Translation table for translating ISO 8859-1 characters to TeX sequences.")
198 ;;;###autoload
199 (defun iso-iso2tex (from to &optional buffer)
200 "Translate ISO 8859-1 characters to TeX sequences.
201 The region between FROM and TO is translated using the table TRANS-TAB.
202 Optional arg BUFFER is ignored (so that the function can can be used in
203 `format-alist')."
204 (interactive "*r")
205 (iso-translate-conventions from to iso-iso2tex-trans-tab))
207 (defvar iso-tex2iso-trans-tab
209 ("{\\\\\"a}" "ä")
210 ("{\\\\`a}" "à")
211 ("{\\\\'a}" "á")
212 ("{\\\\~a}" "ã")
213 ("{\\\\^a}" "â")
214 ("{\\\\\"e}" "ë")
215 ("{\\\\`e}" "è")
216 ("{\\\\'e}" "é")
217 ("{\\\\^e}" "ê")
218 ("{\\\\\"\\\\i}" "ï")
219 ("{\\\\`\\\\i}" "ì")
220 ("{\\\\'\\\\i}" "í")
221 ("{\\\\^\\\\i}" "î")
222 ("{\\\\\"i}" "ï")
223 ("{\\\\`i}" "ì")
224 ("{\\\\'i}" "í")
225 ("{\\\\^i}" "î")
226 ("{\\\\\"o}" "ö")
227 ("{\\\\`o}" "ò")
228 ("{\\\\'o}" "ó")
229 ("{\\\\~o}" "õ")
230 ("{\\\\^o}" "ô")
231 ("{\\\\\"u}" "ü")
232 ("{\\\\`u}" "ù")
233 ("{\\\\'u}" "ú")
234 ("{\\\\^u}" "û")
235 ("{\\\\\"A}" "Ä")
236 ("{\\\\`A}" "À")
237 ("{\\\\'A}" "Á")
238 ("{\\\\~A}" "Ã")
239 ("{\\\\^A}" "Â")
240 ("{\\\\\"E}" "Ë")
241 ("{\\\\`E}" "È")
242 ("{\\\\'E}" "É")
243 ("{\\\\^E}" "Ê")
244 ("{\\\\\"I}" "Ï")
245 ("{\\\\`I}" "Ì")
246 ("{\\\\'I}" "Í")
247 ("{\\\\^I}" "Î")
248 ("{\\\\\"O}" "Ö")
249 ("{\\\\`O}" "Ò")
250 ("{\\\\'O}" "Ó")
251 ("{\\\\~O}" "Õ")
252 ("{\\\\^O}" "Ô")
253 ("{\\\\\"U}" "Ü")
254 ("{\\\\`U}" "Ù")
255 ("{\\\\'U}" "Ú")
256 ("{\\\\^U}" "Û")
257 ("{\\\\~n}" "ñ")
258 ("{\\\\~N}" "Ñ")
259 ("{\\\\c c}" "ç")
260 ("{\\\\c C}" "Ç")
261 ("\\\\\"a" "ä")
262 ("\\\\`a" "à")
263 ("\\\\'a" "á")
264 ("\\\\~a" "ã")
265 ("\\\\^a" "â")
266 ("\\\\\"e" "ë")
267 ("\\\\`e" "è")
268 ("\\\\'e" "é")
269 ("\\\\^e" "ê")
270 ("\\\\\"\\\\i" "ï")
271 ("\\\\`\\\\i" "ì")
272 ("\\\\'\\\\i" "í")
273 ("\\\\^\\\\i" "î")
274 ("\\\\\"i" "ï")
275 ("\\\\`i" "ì")
276 ("\\\\'i" "í")
277 ("\\\\^i" "î")
278 ("\\\\\"o" "ö")
279 ("\\\\`o" "ò")
280 ("\\\\'o" "ó")
281 ("\\\\~o" "õ")
282 ("\\\\^o" "ô")
283 ("\\\\\"u" "ü")
284 ("\\\\`u" "ù")
285 ("\\\\'u" "ú")
286 ("\\\\^u" "û")
287 ("\\\\\"A" "Ä")
288 ("\\\\`A" "À")
289 ("\\\\'A" "Á")
290 ("\\\\~A" "Ã")
291 ("\\\\^A" "Â")
292 ("\\\\\"E" "Ë")
293 ("\\\\`E" "È")
294 ("\\\\'E" "É")
295 ("\\\\^E" "Ê")
296 ("\\\\\"I" "Ï")
297 ("\\\\`I" "Ì")
298 ("\\\\'I" "Í")
299 ("\\\\^I" "Î")
300 ("\\\\\"O" "Ö")
301 ("\\\\`O" "Ò")
302 ("\\\\'O" "Ó")
303 ("\\\\~O" "Õ")
304 ("\\\\^O" "Ô")
305 ("\\\\\"U" "Ü")
306 ("\\\\`U" "Ù")
307 ("\\\\'U" "Ú")
308 ("\\\\^U" "Û")
309 ("\\\\~n" "ñ")
310 ("\\\\~N" "Ñ")
311 ("\\\\\"{a}" "ä")
312 ("\\\\`{a}" "à")
313 ("\\\\'{a}" "á")
314 ("\\\\~{a}" "ã")
315 ("\\\\^{a}" "â")
316 ("\\\\\"{e}" "ë")
317 ("\\\\`{e}" "è")
318 ("\\\\'{e}" "é")
319 ("\\\\^{e}" "ê")
320 ("\\\\\"{\\\\i}" "ï")
321 ("\\\\`{\\\\i}" "ì")
322 ("\\\\'{\\\\i}" "í")
323 ("\\\\^{\\\\i}" "î")
324 ("\\\\\"{i}" "ï")
325 ("\\\\`{i}" "ì")
326 ("\\\\'{i}" "í")
327 ("\\\\^{i}" "î")
328 ("\\\\\"{o}" "ö")
329 ("\\\\`{o}" "ò")
330 ("\\\\'{o}" "ó")
331 ("\\\\~{o}" "õ")
332 ("\\\\^{o}" "ô")
333 ("\\\\\"{u}" "ü")
334 ("\\\\`{u}" "ù")
335 ("\\\\'{u}" "ú")
336 ("\\\\^{u}" "û")
337 ("\\\\\"{A}" "Ä")
338 ("\\\\`{A}" "À")
339 ("\\\\'{A}" "Á")
340 ("\\\\~{A}" "Ã")
341 ("\\\\^{A}" "Â")
342 ("\\\\\"{E}" "Ë")
343 ("\\\\`{E}" "È")
344 ("\\\\'{E}" "É")
345 ("\\\\^{E}" "Ê")
346 ("\\\\\"{I}" "Ï")
347 ("\\\\`{I}" "Ì")
348 ("\\\\'{I}" "Í")
349 ("\\\\^{I}" "Î")
350 ("\\\\\"{O}" "Ö")
351 ("\\\\`{O}" "Ò")
352 ("\\\\'{O}" "Ó")
353 ("\\\\~{O}" "Õ")
354 ("\\\\^{O}" "Ô")
355 ("\\\\\"{U}" "Ü")
356 ("\\\\`{U}" "Ù")
357 ("\\\\'{U}" "Ú")
358 ("\\\\^{U}" "Û")
359 ("\\\\~{n}" "ñ")
360 ("\\\\~{N}" "Ñ")
361 ("\\\\c{c}" "ç")
362 ("\\\\c{C}" "Ç")
363 ("{\\\\ss}" "ß")
364 ("{\\\\AE}" "\306")
365 ("{\\\\ae}" "\346")
366 ("{\\\\AA}" "\305")
367 ("{\\\\aa}" "\345")
368 ("{\\\\copyright}" "\251")
369 ("\\\\copyright{}" "\251")
370 ("{\\\\pounds}" "£" )
371 ("{\\\\P}" "¶" )
372 ("{\\\\S}" "§" )
373 ("\\\\pounds{}" "£" )
374 ("\\\\P{}" "¶" )
375 ("\\\\S{}" "§" )
376 ("{\\?`}" "¿")
377 ("{!`}" "¡")
378 ("\\?`" "¿")
379 ("!`" "¡")
381 "Translation table for translating TeX sequences to ISO 8859-1 characters.
382 This table is not exhaustive (and due to TeX's power can never be). It only
383 contains commonly used sequences.")
385 ;;;###autoload
386 (defun iso-tex2iso (from to &optional buffer)
387 "Translate TeX sequences to ISO 8859-1 characters.
388 The region between FROM and TO is translated using the table TRANS-TAB.
389 Optional arg BUFFER is ignored (so that the function can can be used in
390 `format-alist')."
391 (interactive "*r")
392 (iso-translate-conventions from to iso-tex2iso-trans-tab))
394 (defvar iso-gtex2iso-trans-tab
396 ("{\\\\\"a}" "ä")
397 ("{\\\\`a}" "à")
398 ("{\\\\'a}" "á")
399 ("{\\\\~a}" "ã")
400 ("{\\\\^a}" "â")
401 ("{\\\\\"e}" "ë")
402 ("{\\\\`e}" "è")
403 ("{\\\\'e}" "é")
404 ("{\\\\^e}" "ê")
405 ("{\\\\\"\\\\i}" "ï")
406 ("{\\\\`\\\\i}" "ì")
407 ("{\\\\'\\\\i}" "í")
408 ("{\\\\^\\\\i}" "î")
409 ("{\\\\\"i}" "ï")
410 ("{\\\\`i}" "ì")
411 ("{\\\\'i}" "í")
412 ("{\\\\^i}" "î")
413 ("{\\\\\"o}" "ö")
414 ("{\\\\`o}" "ò")
415 ("{\\\\'o}" "ó")
416 ("{\\\\~o}" "õ")
417 ("{\\\\^o}" "ô")
418 ("{\\\\\"u}" "ü")
419 ("{\\\\`u}" "ù")
420 ("{\\\\'u}" "ú")
421 ("{\\\\^u}" "û")
422 ("{\\\\\"A}" "Ä")
423 ("{\\\\`A}" "À")
424 ("{\\\\'A}" "Á")
425 ("{\\\\~A}" "Ã")
426 ("{\\\\^A}" "Â")
427 ("{\\\\\"E}" "Ë")
428 ("{\\\\`E}" "È")
429 ("{\\\\'E}" "É")
430 ("{\\\\^E}" "Ê")
431 ("{\\\\\"I}" "Ï")
432 ("{\\\\`I}" "Ì")
433 ("{\\\\'I}" "Í")
434 ("{\\\\^I}" "Î")
435 ("{\\\\\"O}" "Ö")
436 ("{\\\\`O}" "Ò")
437 ("{\\\\'O}" "Ó")
438 ("{\\\\~O}" "Õ")
439 ("{\\\\^O}" "Ô")
440 ("{\\\\\"U}" "Ü")
441 ("{\\\\`U}" "Ù")
442 ("{\\\\'U}" "Ú")
443 ("{\\\\^U}" "Û")
444 ("{\\\\~n}" "ñ")
445 ("{\\\\~N}" "Ñ")
446 ("{\\\\c c}" "ç")
447 ("{\\\\c C}" "Ç")
448 ("\\\\\"a" "ä")
449 ("\\\\`a" "à")
450 ("\\\\'a" "á")
451 ("\\\\~a" "ã")
452 ("\\\\^a" "â")
453 ("\\\\\"e" "ë")
454 ("\\\\`e" "è")
455 ("\\\\'e" "é")
456 ("\\\\^e" "ê")
457 ("\\\\\"\\\\i" "ï")
458 ("\\\\`\\\\i" "ì")
459 ("\\\\'\\\\i" "í")
460 ("\\\\^\\\\i" "î")
461 ("\\\\\"i" "ï")
462 ("\\\\`i" "ì")
463 ("\\\\'i" "í")
464 ("\\\\^i" "î")
465 ("\\\\\"o" "ö")
466 ("\\\\`o" "ò")
467 ("\\\\'o" "ó")
468 ("\\\\~o" "õ")
469 ("\\\\^o" "ô")
470 ("\\\\\"u" "ü")
471 ("\\\\`u" "ù")
472 ("\\\\'u" "ú")
473 ("\\\\^u" "û")
474 ("\\\\\"A" "Ä")
475 ("\\\\`A" "À")
476 ("\\\\'A" "Á")
477 ("\\\\~A" "Ã")
478 ("\\\\^A" "Â")
479 ("\\\\\"E" "Ë")
480 ("\\\\`E" "È")
481 ("\\\\'E" "É")
482 ("\\\\^E" "Ê")
483 ("\\\\\"I" "Ï")
484 ("\\\\`I" "Ì")
485 ("\\\\'I" "Í")
486 ("\\\\^I" "Î")
487 ("\\\\\"O" "Ö")
488 ("\\\\`O" "Ò")
489 ("\\\\'O" "Ó")
490 ("\\\\~O" "Õ")
491 ("\\\\^O" "Ô")
492 ("\\\\\"U" "Ü")
493 ("\\\\`U" "Ù")
494 ("\\\\'U" "Ú")
495 ("\\\\^U" "Û")
496 ("\\\\~n" "ñ")
497 ("\\\\~N" "Ñ")
498 ("\\\\\"{a}" "ä")
499 ("\\\\`{a}" "à")
500 ("\\\\'{a}" "á")
501 ("\\\\~{a}" "ã")
502 ("\\\\^{a}" "â")
503 ("\\\\\"{e}" "ë")
504 ("\\\\`{e}" "è")
505 ("\\\\'{e}" "é")
506 ("\\\\^{e}" "ê")
507 ("\\\\\"{\\\\i}" "ï")
508 ("\\\\`{\\\\i}" "ì")
509 ("\\\\'{\\\\i}" "í")
510 ("\\\\^{\\\\i}" "î")
511 ("\\\\\"{i}" "ï")
512 ("\\\\`{i}" "ì")
513 ("\\\\'{i}" "í")
514 ("\\\\^{i}" "î")
515 ("\\\\\"{o}" "ö")
516 ("\\\\`{o}" "ò")
517 ("\\\\'{o}" "ó")
518 ("\\\\~{o}" "õ")
519 ("\\\\^{o}" "ô")
520 ("\\\\\"{u}" "ü")
521 ("\\\\`{u}" "ù")
522 ("\\\\'{u}" "ú")
523 ("\\\\^{u}" "û")
524 ("\\\\\"{A}" "Ä")
525 ("\\\\`{A}" "À")
526 ("\\\\'{A}" "Á")
527 ("\\\\~{A}" "Ã")
528 ("\\\\^{A}" "Â")
529 ("\\\\\"{E}" "Ë")
530 ("\\\\`{E}" "È")
531 ("\\\\'{E}" "É")
532 ("\\\\^{E}" "Ê")
533 ("\\\\\"{I}" "Ï")
534 ("\\\\`{I}" "Ì")
535 ("\\\\'{I}" "Í")
536 ("\\\\^{I}" "Î")
537 ("\\\\\"{O}" "Ö")
538 ("\\\\`{O}" "Ò")
539 ("\\\\'{O}" "Ó")
540 ("\\\\~{O}" "Õ")
541 ("\\\\^{O}" "Ô")
542 ("\\\\\"{U}" "Ü")
543 ("\\\\`{U}" "Ù")
544 ("\\\\'{U}" "Ú")
545 ("\\\\^{U}" "Û")
546 ("\\\\~{n}" "ñ")
547 ("\\\\~{N}" "Ñ")
548 ("\\\\c{c}" "ç")
549 ("\\\\c{C}" "Ç")
550 ("{\\\\ss}" "ß")
551 ("{\\\\AE}" "\306")
552 ("{\\\\ae}" "\346")
553 ("{\\\\AA}" "\305")
554 ("{\\\\aa}" "\345")
555 ("{\\\\copyright}" "\251")
556 ("\\\\copyright{}" "\251")
557 ("{\\\\pounds}" "£" )
558 ("{\\\\P}" "¶" )
559 ("{\\\\S}" "§" )
560 ("\\\\pounds{}" "£" )
561 ("\\\\P{}" "¶" )
562 ("\\\\S{}" "§" )
563 ("?`" "¿")
564 ("!`" "¡")
565 ("{?`}" "¿")
566 ("{!`}" "¡")
567 ("\"a" "ä")
568 ("\"A" "Ä")
569 ("\"o" "ö")
570 ("\"O" "Ö")
571 ("\"u" "ü")
572 ("\"U" "Ü")
573 ("\"s" "ß")
574 ("\\\\3" "ß")
576 "Translation table for translating German TeX sequences to ISO 8859-1.
577 This table is not exhaustive (and due to TeX's power can never be). It only
578 contains commonly used sequences.")
580 (defvar iso-iso2gtex-trans-tab
582 ("ä" "\"a")
583 ("à" "{\\\\`a}")
584 ("á" "{\\\\'a}")
585 ("ã" "{\\\\~a}")
586 ("â" "{\\\\^a}")
587 ("ë" "{\\\\\"e}")
588 ("è" "{\\\\`e}")
589 ("é" "{\\\\'e}")
590 ("ê" "{\\\\^e}")
591 ("ï" "{\\\\\"\\\\i}")
592 ("ì" "{\\\\`\\\\i}")
593 ("í" "{\\\\'\\\\i}")
594 ("î" "{\\\\^\\\\i}")
595 ("ö" "\"o")
596 ("ò" "{\\\\`o}")
597 ("ó" "{\\\\'o}")
598 ("õ" "{\\\\~o}")
599 ("ô" "{\\\\^o}")
600 ("ü" "\"u")
601 ("ù" "{\\\\`u}")
602 ("ú" "{\\\\'u}")
603 ("û" "{\\\\^u}")
604 ("Ä" "\"A")
605 ("À" "{\\\\`A}")
606 ("Á" "{\\\\'A}")
607 ("Ã" "{\\\\~A}")
608 ("Â" "{\\\\^A}")
609 ("Ë" "{\\\\\"E}")
610 ("È" "{\\\\`E}")
611 ("É" "{\\\\'E}")
612 ("Ê" "{\\\\^E}")
613 ("Ï" "{\\\\\"I}")
614 ("Ì" "{\\\\`I}")
615 ("Í" "{\\\\'I}")
616 ("Î" "{\\\\^I}")
617 ("Ö" "\"O")
618 ("Ò" "{\\\\`O}")
619 ("Ó" "{\\\\'O}")
620 ("Õ" "{\\\\~O}")
621 ("Ô" "{\\\\^O}")
622 ("Ü" "\"U")
623 ("Ù" "{\\\\`U}")
624 ("Ú" "{\\\\'U}")
625 ("Û" "{\\\\^U}")
626 ("ñ" "{\\\\~n}")
627 ("Ñ" "{\\\\~N}")
628 ("ç" "{\\\\c c}")
629 ("Ç" "{\\\\c C}")
630 ("ß" "\"s")
631 ("\306" "{\\\\AE}")
632 ("\346" "{\\\\ae}")
633 ("\305" "{\\\\AA}")
634 ("\345" "{\\\\aa}")
635 ("\251" "{\\\\copyright}")
636 ("£" "{\\\\pounds}")
637 ("¶" "{\\\\P}")
638 ("§" "{\\\\S}")
639 ("¿" "{?`}")
640 ("¡" "{!`}")
642 "Translation table for translating ISO 8859-1 characters to German TeX.")
644 ;;;###autoload
645 (defun iso-gtex2iso (from to &optional buffer)
646 "Translate German TeX sequences to ISO 8859-1 characters.
647 The region between FROM and TO is translated using the table TRANS-TAB.
648 Optional arg BUFFER is ignored (so that the function can can be used in
649 `format-alist')."
650 (interactive "*r")
651 (iso-translate-conventions from to iso-gtex2iso-trans-tab))
653 ;;;###autoload
654 (defun iso-iso2gtex (from to &optional buffer)
655 "Translate ISO 8859-1 characters to German TeX sequences.
656 The region between FROM and TO is translated using the table TRANS-TAB.
657 Optional arg BUFFER is ignored (so that the function can can be used in
658 `format-alist')."
659 (interactive "*r")
660 (iso-translate-conventions from to iso-iso2gtex-trans-tab))
662 (defvar iso-iso2duden-trans-tab
663 '(("ä" "ae")
664 ("Ä" "Ae")
665 ("ö" "oe")
666 ("Ö" "Oe")
667 ("ü" "ue")
668 ("Ü" "Ue")
669 ("ß" "ss")))
671 ;;;###autoload
672 (defun iso-iso2duden (from to &optional buffer)
673 "Translate ISO 8859-1 characters to German TeX sequences.
674 The region between FROM and TO is translated using the table TRANS-TAB.
675 Optional arg BUFFER is ignored (so that the function can can be used in
676 `format-alist')."
677 (interactive "*r")
678 (iso-translate-conventions from to iso-iso2duden-trans-tab))
680 (defvar iso-iso2sgml-trans-tab
681 '(("À" "&Agrave;")
682 ("Á" "&Aacute;")
683 ("Â" "&Acirc;")
684 ("Ã" "&Atilde;")
685 ("Ä" "&Auml;")
686 ("Å" "&Aring;")
687 ("Æ" "&AElig;")
688 ("Ç" "&Ccedil;")
689 ("È" "&Egrave;")
690 ("É" "&Eacute;")
691 ("Ê" "&Ecirc;")
692 ("Ë" "&Euml;")
693 ("Ì" "&Igrave;")
694 ("Í" "&Iacute;")
695 ("Î" "&Icirc;")
696 ("Ï" "&Iuml;")
697 ("Ð" "&ETH;")
698 ("Ñ" "&Ntilde;")
699 ("Ò" "&Ograve;")
700 ("Ó" "&Oacute;")
701 ("Ô" "&Ocirc;")
702 ("Õ" "&Otilde;")
703 ("Ö" "&Ouml;")
704 ("Ø" "&Oslash;")
705 ("Ù" "&Ugrave;")
706 ("Ú" "&Uacute;")
707 ("Û" "&Ucirc;")
708 ("Ü" "&Uuml;")
709 ("Ý" "&Yacute;")
710 ("Þ" "&THORN;")
711 ("ß" "&szlig;")
712 ("à" "&agrave;")
713 ("á" "&aacute;")
714 ("â" "&acirc;")
715 ("ã" "&atilde;")
716 ("ä" "&auml;")
717 ("å" "&aring;")
718 ("æ" "&aelig;")
719 ("ç" "&ccedil;")
720 ("è" "&egrave;")
721 ("é" "&eacute;")
722 ("ê" "&ecirc;")
723 ("ë" "&euml;")
724 ("ì" "&igrave;")
725 ("í" "&iacute;")
726 ("î" "&icirc;")
727 ("ï" "&iuml;")
728 ("ð" "&eth;")
729 ("ñ" "&ntilde;")
730 ("ò" "&ograve;")
731 ("ó" "&oacute;")
732 ("ô" "&ocirc;")
733 ("õ" "&otilde;")
734 ("ö" "&ouml;")
735 ("ø" "&oslash;")
736 ("ù" "&ugrave;")
737 ("ú" "&uacute;")
738 ("û" "&ucirc;")
739 ("ü" "&uuml;")
740 ("ý" "&yacute;")
741 ("þ" "&thorn;")
742 ("ÿ" "&yuml;")))
744 (defvar iso-sgml2iso-trans-tab
745 '(("&Agrave;" "À")
746 ("&Aacute;" "Á")
747 ("&Acirc;" "Â")
748 ("&Atilde;" "Ã")
749 ("&Auml;" "Ä")
750 ("&Aring;" "Å")
751 ("&AElig;" "Æ")
752 ("&Ccedil;" "Ç")
753 ("&Egrave;" "È")
754 ("&Eacute;" "É")
755 ("&Ecirc;" "Ê")
756 ("&Euml;" "Ë")
757 ("&Igrave;" "Ì")
758 ("&Iacute;" "Í")
759 ("&Icirc;" "Î")
760 ("&Iuml;" "Ï")
761 ("&ETH;" "Ð")
762 ("&Ntilde;" "Ñ")
763 ("&Ograve;" "Ò")
764 ("&Oacute;" "Ó")
765 ("&Ocirc;" "Ô")
766 ("&Otilde;" "Õ")
767 ("&Ouml;" "Ö")
768 ("&Oslash;" "Ø")
769 ("&Ugrave;" "Ù")
770 ("&Uacute;" "Ú")
771 ("&Ucirc;" "Û")
772 ("&Uuml;" "Ü")
773 ("&Yacute;" "Ý")
774 ("&THORN;" "Þ")
775 ("&szlig;" "ß")
776 ("&agrave;" "à")
777 ("&aacute;" "á")
778 ("&acirc;" "â")
779 ("&atilde;" "ã")
780 ("&auml;" "ä")
781 ("&aring;" "å")
782 ("&aelig;" "æ")
783 ("&ccedil;" "ç")
784 ("&egrave;" "è")
785 ("&eacute;" "é")
786 ("&ecirc;" "ê")
787 ("&euml;" "ë")
788 ("&igrave;" "ì")
789 ("&iacute;" "í")
790 ("&icirc;" "î")
791 ("&iuml;" "ï")
792 ("&eth;" "ð")
793 ("&ntilde;" "ñ")
794 ("&ograve;" "ò")
795 ("&oacute;" "ó")
796 ("&ocirc;" "ô")
797 ("&otilde;" "õ")
798 ("&ouml;" "ö")
799 ("&oslash;" "ø")
800 ("&ugrave;" "ù")
801 ("&uacute;" "ú")
802 ("&ucirc;" "û")
803 ("&uuml;" "ü")
804 ("&yacute;" "ý")
805 ("&thorn;" "þ")
806 ("&yuml;" "ÿ")))
808 ;;;###autoload
809 (defun iso-iso2sgml (from to &optional buffer)
810 "Translate ISO 8859-1 characters in the region to SGML entities.
811 The entities used are from \"ISO 8879:1986//ENTITIES Added Latin 1//EN\".
812 Optional arg BUFFER is ignored (so that the function can can be used in
813 `format-alist')."
814 (interactive "*r")
815 (iso-translate-conventions from to iso-iso2sgml-trans-tab))
817 ;;;###autoload
818 (defun iso-sgml2iso (from to &optional buffer)
819 "Translate SGML entities in the region to ISO 8859-1 characters.
820 The entities used are from \"ISO 8879:1986//ENTITIES Added Latin 1//EN\".
821 Optional arg BUFFER is ignored (so that the function can can be used in
822 `format-alist')."
823 (interactive "*r")
824 (iso-translate-conventions from to iso-sgml2iso-trans-tab))
826 ;;;###autoload
827 (defun iso-cvt-read-only ()
828 "Warn that format is read-only."
829 (interactive)
830 (error "This format is read-only; specify another format for writing"))
832 ;;;###autoload
833 (defun iso-cvt-write-only ()
834 "Warn that format is write-only."
835 (interactive)
836 (error "This format is write-only"))
838 ;;;###autoload
839 (defun iso-cvt-define-menu ()
840 "Add submenus to the Files menu, to convert to and from various formats."
841 (interactive)
843 (define-key menu-bar-files-menu [load-as-separator] '("--"))
845 (define-key menu-bar-files-menu [load-as] '("Load As..." . load-as))
846 (defvar load-as-menu-map (make-sparse-keymap "Load As..."))
847 (fset 'load-as load-as-menu-map)
849 ;;(define-key menu-bar-files-menu [insert-as] '("Insert As..." . insert-as))
850 (defvar insert-as-menu-map (make-sparse-keymap "Insert As..."))
851 (fset 'insert-as insert-as-menu-map)
853 (define-key menu-bar-files-menu [write-as] '("Write As..." . write-as))
854 (defvar write-as-menu-map (make-sparse-keymap "Write As..."))
855 (fset 'write-as write-as-menu-map)
857 (define-key menu-bar-files-menu [translate-separator] '("--"))
859 (define-key menu-bar-files-menu [translate-to] '("Translate to..." . translate-to))
860 (defvar translate-to-menu-map (make-sparse-keymap "Translate to..."))
861 (fset 'translate-to translate-to-menu-map)
863 (define-key menu-bar-files-menu [translate-from] '("Translate from..." . translate-from))
864 (defvar translate-from-menu-map (make-sparse-keymap "Translate from..."))
865 (fset 'translate-from translate-from-menu-map)
867 (let ((file-types (reverse format-alist))
868 name
869 str-name)
870 (while file-types
871 (setq name (car (car file-types))
872 str-name (car (cdr (car file-types)))
873 file-types (cdr file-types))
874 (if (stringp str-name)
875 (progn
876 (define-key load-as-menu-map (vector name)
877 (cons str-name
878 `(lambda (file)
879 (interactive (format "FFind file (as %s): " ,name))
880 (format-find-file file ',name))))
881 (define-key insert-as-menu-map (vector name)
882 (cons str-name
883 `(lambda (file)
884 (interactive (format "FInsert file (as %s): " ,name))
885 (format-insert-file file ',name))))
886 (define-key write-as-menu-map (vector name)
887 (cons str-name
888 `(lambda (file)
889 (interactive (format "FWrite file (as %s): " ,name))
890 (format-write-file file ',name))))
891 (define-key translate-to-menu-map (vector name)
892 (cons str-name
893 `(lambda ()
894 (interactive)
895 (format-encode-buffer ',name))))
896 (define-key translate-from-menu-map (vector name)
897 (cons str-name
898 `(lambda ()
899 (interactive)
900 (format-decode-buffer ',name)))))))))
902 (provide 'iso-cvt)
904 ;;; iso-cvt.el ends here