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. 3 4;; Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 2000, 2001, 5;; 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. 6 7;; Author: Michael Gschwind <mike@vlsivie.tuwien.ac.at> 8;; Keywords: tex, iso, latin, i18n 9 10;; This file is part of GNU Emacs. 11 12;; GNU Emacs is free software; you can redistribute it and/or modify 13;; it under the terms of the GNU General Public License as published by 14;; the Free Software Foundation; either version 2, or (at your option) 15;; any later version. 16 17;; GNU Emacs is distributed in the hope that it will be useful, 18;; but WITHOUT ANY WARRANTY; without even the implied warranty of 19;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20;; GNU General Public License for more details. 21 22;; You should have received a copy of the GNU General Public License 23;; along with GNU Emacs; see the file COPYING. If not, write to the 24;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 25;; Boston, MA 02110-1301, USA. 26 27;;; Commentary: 28;; This lisp code is a general framework for translating various 29;; representations of the same data. 30;; among other things it can be used to translate TeX, HTML, and compressed 31;; files to ISO 8859-1. It can also be used to translate different charsets 32;; such as IBM PC, Macintosh or HP Roman8. 33;; Note that many translations use the GNU recode tool to do the actual 34;; conversion. So you might want to install that tool to get the full 35;; benefit of iso-cvt.el 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/8bit/FAQ-ISO-8859-1 46 47;;; Code: 48 49(defvar iso-spanish-trans-tab 50 '( 51 ("~n" "�") 52 ("\([a-zA-Z]\)#" "\\1�") 53 ("~N" "�") 54 ("\\([-a-zA-Z\"`]\\)\"u" "\\1�") 55 ("\\([-a-zA-Z\"`]\\)\"U" "\\1�") 56 ("\\([-a-zA-Z]\\)'o" "\\1�") 57 ("\\([-a-zA-Z]\\)'O" "\\�") 58 ("\\([-a-zA-Z]\\)'e" "\\1�") 59 ("\\([-a-zA-Z]\\)'E" "\\1�") 60 ("\\([-a-zA-Z]\\)'a" "\\1�") 61 ("\\([-a-zA-Z]\\)'A" "\\1A") 62 ("\\([-a-zA-Z]\\)'i" "\\1�") 63 ("\\([-a-zA-Z]\\)'I" "\\1�") 64 ) 65 "Spanish translation table.") 66 67(defun iso-translate-conventions (from to trans-tab) 68 "Use the translation table TRANS-TAB to translate the current buffer." 69 (save-excursion 70 (save-restriction 71 (narrow-to-region from to) 72 (goto-char from) 73 (let ((work-tab trans-tab) 74 (buffer-read-only nil) 75 (case-fold-search nil)) 76 (while work-tab 77 (save-excursion 78 (let ((trans-this (car work-tab))) 79 (while (re-search-forward (car trans-this) nil t) 80 (replace-match (car (cdr trans-this)) t nil))) 81 (setq work-tab (cdr work-tab))))) 82 (point-max)))) 83 84;;;###autoload 85(defun iso-spanish (from to &optional buffer) 86 "Translate net conventions for Spanish to ISO 8859-1. 87The region between FROM and TO is translated using the table TRANS-TAB. 88Optional arg BUFFER is ignored (for use in `format-alist')." 89 (interactive "*r") 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. 104This table uses an aggressive translation approach and may erroneously 105translate 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. 119This table uses a conservative translation approach and may translate too 120little.") 121 122(defvar iso-german-trans-tab iso-aggressive-german-trans-tab 123 "Currently active translation table for German.") 124 125;;;###autoload 126(defun iso-german (from to &optional buffer) 127 "Translate net conventions for German to ISO 8859-1. 128The region between FROM and TO is translated using the table TRANS-TAB. 129Optional arg BUFFER is ignored (for use in `format-alist')." 130 (interactive "*r") 131 (iso-translate-conventions from to iso-german-trans-tab)) 132 133(defvar iso-iso2tex-trans-tab 134 '( 135 ("�" "{\\\\\"a}") 136 ("�" "{\\\\`a}") 137 ("�" "{\\\\'a}") 138 ("�" "{\\\\~a}") 139 ("�" "{\\\\^a}") 140 ("�" "{\\\\\"e}") 141 ("�" "{\\\\`e}") 142 ("�" "{\\\\'e}") 143 ("�" "{\\\\^e}") 144 ("�" "{\\\\\"\\\\i}") 145 ("�" "{\\\\`\\\\i}") 146 ("�" "{\\\\'\\\\i}") 147 ("�" "{\\\\^\\\\i}") 148 ("�" "{\\\\\"o}") 149 ("�" "{\\\\`o}") 150 ("�" "{\\\\'o}") 151 ("�" "{\\\\~o}") 152 ("�" "{\\\\^o}") 153 ("�" "{\\\\\"u}") 154 ("�" "{\\\\`u}") 155 ("�" "{\\\\'u}") 156 ("�" "{\\\\^u}") 157 ("�" "{\\\\\"A}") 158 ("�" "{\\\\`A}") 159 ("�" "{\\\\'A}") 160 ("�" "{\\\\~A}") 161 ("�" "{\\\\^A}") 162 ("�" "{\\\\\"E}") 163 ("�" "{\\\\`E}") 164 ("�" "{\\\\'E}") 165 ("�" "{\\\\^E}") 166 ("�" "{\\\\\"I}") 167 ("�" "{\\\\`I}") 168 ("�" "{\\\\'I}") 169 ("�" "{\\\\^I}") 170 ("�" "{\\\\\"O}") 171 ("�" "{\\\\`O}") 172 ("�" "{\\\\'O}") 173 ("�" "{\\\\~O}") 174 ("�" "{\\\\^O}") 175 ("�" "{\\\\\"U}") 176 ("�" "{\\\\`U}") 177 ("�" "{\\\\'U}") 178 ("�" "{\\\\^U}") 179 ("�" "{\\\\~n}") 180 ("�" "{\\\\~N}") 181 ("�" "{\\\\c c}") 182 ("�" "{\\\\c C}") 183 ("�" "{\\\\ss}") 184 ("\306" "{\\\\AE}") 185 ("\346" "{\\\\ae}") 186 ("\305" "{\\\\AA}") 187 ("\345" "{\\\\aa}") 188 ("\251" "{\\\\copyright}") 189 ("�" "{\\\\pounds}") 190 ("�" "{\\\\P}") 191 ("�" "{\\\\S}") 192 ("�" "{?`}") 193 ("�" "{!`}") 194 ) 195 "Translation table for translating ISO 8859-1 characters to TeX sequences.") 196 197;;;###autoload 198(defun iso-iso2tex (from to &optional buffer) 199 "Translate ISO 8859-1 characters to TeX sequences. 200The region between FROM and TO is translated using the table TRANS-TAB. 201Optional arg BUFFER is ignored (for use in `format-alist')." 202 (interactive "*r") 203 (iso-translate-conventions from to iso-iso2tex-trans-tab)) 204 205(defvar iso-tex2iso-trans-tab 206 '( 207 ("{\\\\\"a}" "�") 208 ("{\\\\`a}" "�") 209 ("{\\\\'a}" "�") 210 ("{\\\\~a}" "�") 211 ("{\\\\^a}" "�") 212 ("{\\\\\"e}" "�") 213 ("{\\\\`e}" "�") 214 ("{\\\\'e}" "�") 215 ("{\\\\^e}" "�") 216 ("{\\\\\"\\\\i}" "�") 217 ("{\\\\`\\\\i}" "�") 218 ("{\\\\'\\\\i}" "�") 219 ("{\\\\^\\\\i}" "�") 220 ("{\\\\\"i}" "�") 221 ("{\\\\`i}" "�") 222 ("{\\\\'i}" "�") 223 ("{\\\\^i}" "�") 224 ("{\\\\\"o}" "�") 225 ("{\\\\`o}" "�") 226 ("{\\\\'o}" "�") 227 ("{\\\\~o}" "�") 228 ("{\\\\^o}" "�") 229 ("{\\\\\"u}" "�") 230 ("{\\\\`u}" "�") 231 ("{\\\\'u}" "�") 232 ("{\\\\^u}" "�") 233 ("{\\\\\"A}" "�") 234 ("{\\\\`A}" "�") 235 ("{\\\\'A}" "�") 236 ("{\\\\~A}" "�") 237 ("{\\\\^A}" "�") 238 ("{\\\\\"E}" "�") 239 ("{\\\\`E}" "�") 240 ("{\\\\'E}" "�") 241 ("{\\\\^E}" "�") 242 ("{\\\\\"I}" "�") 243 ("{\\\\`I}" "�") 244 ("{\\\\'I}" "�") 245 ("{\\\\^I}" "�") 246 ("{\\\\\"O}" "�") 247 ("{\\\\`O}" "�") 248 ("{\\\\'O}" "�") 249 ("{\\\\~O}" "�") 250 ("{\\\\^O}" "�") 251 ("{\\\\\"U}" "�") 252 ("{\\\\`U}" "�") 253 ("{\\\\'U}" "�") 254 ("{\\\\^U}" "�") 255 ("{\\\\~n}" "�") 256 ("{\\\\~N}" "�") 257 ("{\\\\c c}" "�") 258 ("{\\\\c C}" "�") 259 ("\\\\\"a" "�") 260 ("\\\\`a" "�") 261 ("\\\\'a" "�") 262 ("\\\\~a" "�") 263 ("\\\\^a" "�") 264 ("\\\\\"e" "�") 265 ("\\\\`e" "�") 266 ("\\\\'e" "�") 267 ("\\\\^e" "�") 268 ;; Discard spaces and/or one EOF after macro \i. 269 ;; Converting it back will use braces. 270 ("\\\\\"\\\\i *\n\n" "�\n\n") 271 ("\\\\\"\\\\i *\n?" "�") 272 ("\\\\`\\\\i *\n\n" "�\n\n") 273 ("\\\\`\\\\i *\n?" "�") 274 ("\\\\'\\\\i *\n\n" "�\n\n") 275 ("\\\\'\\\\i *\n?" "�") 276 ("\\\\^\\\\i *\n\n" "�\n\n") 277 ("\\\\^\\\\i *\n?" "�") 278 ("\\\\\"i" "�") 279 ("\\\\`i" "�") 280 ("\\\\'i" "�") 281 ("\\\\^i" "�") 282 ("\\\\\"o" "�") 283 ("\\\\`o" "�") 284 ("\\\\'o" "�") 285 ("\\\\~o" "�") 286 ("\\\\^o" "�") 287 ("\\\\\"u" "�") 288 ("\\\\`u" "�") 289 ("\\\\'u" "�") 290 ("\\\\^u" "�") 291 ("\\\\\"A" "�") 292 ("\\\\`A" "�") 293 ("\\\\'A" "�") 294 ("\\\\~A" "�") 295 ("\\\\^A" "�") 296 ("\\\\\"E" "�") 297 ("\\\\`E" "�") 298 ("\\\\'E" "�") 299 ("\\\\^E" "�") 300 ("\\\\\"I" "�") 301 ("\\\\`I" "�") 302 ("\\\\'I" "�") 303 ("\\\\^I" "�") 304 ("\\\\\"O" "�") 305 ("\\\\`O" "�") 306 ("\\\\'O" "�") 307 ("\\\\~O" "�") 308 ("\\\\^O" "�") 309 ("\\\\\"U" "�") 310 ("\\\\`U" "�") 311 ("\\\\'U" "�") 312 ("\\\\^U" "�") 313 ("\\\\~n" "�") 314 ("\\\\~N" "�") 315 ("\\\\\"{a}" "�") 316 ("\\\\`{a}" "�") 317 ("\\\\'{a}" "�") 318 ("\\\\~{a}" "�") 319 ("\\\\^{a}" "�") 320 ("\\\\\"{e}" "�") 321 ("\\\\`{e}" "�") 322 ("\\\\'{e}" "�") 323 ("\\\\^{e}" "�") 324 ("\\\\\"{\\\\i}" "�") 325 ("\\\\`{\\\\i}" "�") 326 ("\\\\'{\\\\i}" "�") 327 ("\\\\^{\\\\i}" "�") 328 ("\\\\\"{i}" "�") 329 ("\\\\`{i}" "�") 330 ("\\\\'{i}" "�") 331 ("\\\\^{i}" "�") 332 ("\\\\\"{o}" "�") 333 ("\\\\`{o}" "�") 334 ("\\\\'{o}" "�") 335 ("\\\\~{o}" "�") 336 ("\\\\^{o}" "�") 337 ("\\\\\"{u}" "�") 338 ("\\\\`{u}" "�") 339 ("\\\\'{u}" "�") 340 ("\\\\^{u}" "�") 341 ("\\\\\"{A}" "�") 342 ("\\\\`{A}" "�") 343 ("\\\\'{A}" "�") 344 ("\\\\~{A}" "�") 345 ("\\\\^{A}" "�") 346 ("\\\\\"{E}" "�") 347 ("\\\\`{E}" "�") 348 ("\\\\'{E}" "�") 349 ("\\\\^{E}" "�") 350 ("\\\\\"{I}" "�") 351 ("\\\\`{I}" "�") 352 ("\\\\'{I}" "�") 353 ("\\\\^{I}" "�") 354 ("\\\\\"{O}" "�") 355 ("\\\\`{O}" "�") 356 ("\\\\'{O}" "�") 357 ("\\\\~{O}" "�") 358 ("\\\\^{O}" "�") 359 ("\\\\\"{U}" "�") 360 ("\\\\`{U}" "�") 361 ("\\\\'{U}" "�") 362 ("\\\\^{U}" "�") 363 ("\\\\~{n}" "�") 364 ("\\\\~{N}" "�") 365 ("\\\\c{c}" "�") 366 ("\\\\c{C}" "�") 367 ("{\\\\ss}" "�") 368 ("{\\\\AE}" "\306") 369 ("{\\\\ae}" "\346") 370 ("{\\\\AA}" "\305") 371 ("{\\\\aa}" "\345") 372 ("{\\\\copyright}" "\251") 373 ("\\\\copyright{}" "\251") 374 ("{\\\\pounds}" "�" ) 375 ("{\\\\P}" "�" ) 376 ("{\\\\S}" "�" ) 377 ("\\\\pounds{}" "�" ) 378 ("\\\\P{}" "�" ) 379 ("\\\\S{}" "�" ) 380 ("{\\?`}" "�") 381 ("{!`}" "�") 382 ("\\?`" "�") 383 ("!`" "�") 384 ) 385 "Translation table for translating TeX sequences to ISO 8859-1 characters. 386This table is not exhaustive (and due to TeX's power can never be). It only 387contains commonly used sequences.") 388 389;;;###autoload 390(defun iso-tex2iso (from to &optional buffer) 391 "Translate TeX sequences to ISO 8859-1 characters. 392The region between FROM and TO is translated using the table TRANS-TAB. 393Optional arg BUFFER is ignored (for use in `format-alist')." 394 (interactive "*r") 395 (iso-translate-conventions from to iso-tex2iso-trans-tab)) 396 397(defvar iso-gtex2iso-trans-tab 398 '( 399 ("{\\\\\"a}" "�") 400 ("{\\\\`a}" "�") 401 ("{\\\\'a}" "�") 402 ("{\\\\~a}" "�") 403 ("{\\\\^a}" "�") 404 ("{\\\\\"e}" "�") 405 ("{\\\\`e}" "�") 406 ("{\\\\'e}" "�") 407 ("{\\\\^e}" "�") 408 ("{\\\\\"\\\\i}" "�") 409 ("{\\\\`\\\\i}" "�") 410 ("{\\\\'\\\\i}" "�") 411 ("{\\\\^\\\\i}" "�") 412 ("{\\\\\"i}" "�") 413 ("{\\\\`i}" "�") 414 ("{\\\\'i}" "�") 415 ("{\\\\^i}" "�") 416 ("{\\\\\"o}" "�") 417 ("{\\\\`o}" "�") 418 ("{\\\\'o}" "�") 419 ("{\\\\~o}" "�") 420 ("{\\\\^o}" "�") 421 ("{\\\\\"u}" "�") 422 ("{\\\\`u}" "�") 423 ("{\\\\'u}" "�") 424 ("{\\\\^u}" "�") 425 ("{\\\\\"A}" "�") 426 ("{\\\\`A}" "�") 427 ("{\\\\'A}" "�") 428 ("{\\\\~A}" "�") 429 ("{\\\\^A}" "�") 430 ("{\\\\\"E}" "�") 431 ("{\\\\`E}" "�") 432 ("{\\\\'E}" "�") 433 ("{\\\\^E}" "�") 434 ("{\\\\\"I}" "�") 435 ("{\\\\`I}" "�") 436 ("{\\\\'I}" "�") 437 ("{\\\\^I}" "�") 438 ("{\\\\\"O}" "�") 439 ("{\\\\`O}" "�") 440 ("{\\\\'O}" "�") 441 ("{\\\\~O}" "�") 442 ("{\\\\^O}" "�") 443 ("{\\\\\"U}" "�") 444 ("{\\\\`U}" "�") 445 ("{\\\\'U}" "�") 446 ("{\\\\^U}" "�") 447 ("{\\\\~n}" "�") 448 ("{\\\\~N}" "�") 449 ("{\\\\c c}" "�") 450 ("{\\\\c C}" "�") 451 ("\\\\\"a" "�") 452 ("\\\\`a" "�") 453 ("\\\\'a" "�") 454 ("\\\\~a" "�") 455 ("\\\\^a" "�") 456 ("\\\\\"e" "�") 457 ("\\\\`e" "�") 458 ("\\\\'e" "�") 459 ("\\\\^e" "�") 460 ("\\\\\"\\\\i" "�") 461 ("\\\\`\\\\i" "�") 462 ("\\\\'\\\\i" "�") 463 ("\\\\^\\\\i" "�") 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 ("\\\\\"A" "�") 478 ("\\\\`A" "�") 479 ("\\\\'A" "�") 480 ("\\\\~A" "�") 481 ("\\\\^A" "�") 482 ("\\\\\"E" "�") 483 ("\\\\`E" "�") 484 ("\\\\'E" "�") 485 ("\\\\^E" "�") 486 ("\\\\\"I" "�") 487 ("\\\\`I" "�") 488 ("\\\\'I" "�") 489 ("\\\\^I" "�") 490 ("\\\\\"O" "�") 491 ("\\\\`O" "�") 492 ("\\\\'O" "�") 493 ("\\\\~O" "�") 494 ("\\\\^O" "�") 495 ("\\\\\"U" "�") 496 ("\\\\`U" "�") 497 ("\\\\'U" "�") 498 ("\\\\^U" "�") 499 ("\\\\~n" "�") 500 ("\\\\~N" "�") 501 ("\\\\\"{a}" "�") 502 ("\\\\`{a}" "�") 503 ("\\\\'{a}" "�") 504 ("\\\\~{a}" "�") 505 ("\\\\^{a}" "�") 506 ("\\\\\"{e}" "�") 507 ("\\\\`{e}" "�") 508 ("\\\\'{e}" "�") 509 ("\\\\^{e}" "�") 510 ("\\\\\"{\\\\i}" "�") 511 ("\\\\`{\\\\i}" "�") 512 ("\\\\'{\\\\i}" "�") 513 ("\\\\^{\\\\i}" "�") 514 ("\\\\\"{i}" "�") 515 ("\\\\`{i}" "�") 516 ("\\\\'{i}" "�") 517 ("\\\\^{i}" "�") 518 ("\\\\\"{o}" "�") 519 ("\\\\`{o}" "�") 520 ("\\\\'{o}" "�") 521 ("\\\\~{o}" "�") 522 ("\\\\^{o}" "�") 523 ("\\\\\"{u}" "�") 524 ("\\\\`{u}" "�") 525 ("\\\\'{u}" "�") 526 ("\\\\^{u}" "�") 527 ("\\\\\"{A}" "�") 528 ("\\\\`{A}" "�") 529 ("\\\\'{A}" "�") 530 ("\\\\~{A}" "�") 531 ("\\\\^{A}" "�") 532 ("\\\\\"{E}" "�") 533 ("\\\\`{E}" "�") 534 ("\\\\'{E}" "�") 535 ("\\\\^{E}" "�") 536 ("\\\\\"{I}" "�") 537 ("\\\\`{I}" "�") 538 ("\\\\'{I}" "�") 539 ("\\\\^{I}" "�") 540 ("\\\\\"{O}" "�") 541 ("\\\\`{O}" "�") 542 ("\\\\'{O}" "�") 543 ("\\\\~{O}" "�") 544 ("\\\\^{O}" "�") 545 ("\\\\\"{U}" "�") 546 ("\\\\`{U}" "�") 547 ("\\\\'{U}" "�") 548 ("\\\\^{U}" "�") 549 ("\\\\~{n}" "�") 550 ("\\\\~{N}" "�") 551 ("\\\\c{c}" "�") 552 ("\\\\c{C}" "�") 553 ("{\\\\ss}" "�") 554 ("{\\\\AE}" "\306") 555 ("{\\\\ae}" "\346") 556 ("{\\\\AA}" "\305") 557 ("{\\\\aa}" "\345") 558 ("{\\\\copyright}" "\251") 559 ("\\\\copyright{}" "\251") 560 ("{\\\\pounds}" "�" ) 561 ("{\\\\P}" "�" ) 562 ("{\\\\S}" "�" ) 563 ("\\\\pounds{}" "�" ) 564 ("\\\\P{}" "�" ) 565 ("\\\\S{}" "�" ) 566 ("?`" "�") 567 ("!`" "�") 568 ("{?`}" "�") 569 ("{!`}" "�") 570 ("\"a" "�") 571 ("\"A" "�") 572 ("\"o" "�") 573 ("\"O" "�") 574 ("\"u" "�") 575 ("\"U" "�") 576 ("\"s" "�") 577 ("\\\\3" "�") 578 ) 579 "Translation table for translating German TeX sequences to ISO 8859-1. 580This table is not exhaustive (and due to TeX's power can never be). It only 581contains commonly used sequences.") 582 583(defvar iso-iso2gtex-trans-tab 584 '( 585 ("�" "\"a") 586 ("�" "{\\\\`a}") 587 ("�" "{\\\\'a}") 588 ("�" "{\\\\~a}") 589 ("�" "{\\\\^a}") 590 ("�" "{\\\\\"e}") 591 ("�" "{\\\\`e}") 592 ("�" "{\\\\'e}") 593 ("�" "{\\\\^e}") 594 ("�" "{\\\\\"\\\\i}") 595 ("�" "{\\\\`\\\\i}") 596 ("�" "{\\\\'\\\\i}") 597 ("�" "{\\\\^\\\\i}") 598 ("�" "\"o") 599 ("�" "{\\\\`o}") 600 ("�" "{\\\\'o}") 601 ("�" "{\\\\~o}") 602 ("�" "{\\\\^o}") 603 ("�" "\"u") 604 ("�" "{\\\\`u}") 605 ("�" "{\\\\'u}") 606 ("�" "{\\\\^u}") 607 ("�" "\"A") 608 ("�" "{\\\\`A}") 609 ("�" "{\\\\'A}") 610 ("�" "{\\\\~A}") 611 ("�" "{\\\\^A}") 612 ("�" "{\\\\\"E}") 613 ("�" "{\\\\`E}") 614 ("�" "{\\\\'E}") 615 ("�" "{\\\\^E}") 616 ("�" "{\\\\\"I}") 617 ("�" "{\\\\`I}") 618 ("�" "{\\\\'I}") 619 ("�" "{\\\\^I}") 620 ("�" "\"O") 621 ("�" "{\\\\`O}") 622 ("�" "{\\\\'O}") 623 ("�" "{\\\\~O}") 624 ("�" "{\\\\^O}") 625 ("�" "\"U") 626 ("�" "{\\\\`U}") 627 ("�" "{\\\\'U}") 628 ("�" "{\\\\^U}") 629 ("�" "{\\\\~n}") 630 ("�" "{\\\\~N}") 631 ("�" "{\\\\c c}") 632 ("�" "{\\\\c C}") 633 ("�" "\"s") 634 ("\306" "{\\\\AE}") 635 ("\346" "{\\\\ae}") 636 ("\305" "{\\\\AA}") 637 ("\345" "{\\\\aa}") 638 ("\251" "{\\\\copyright}") 639 ("�" "{\\\\pounds}") 640 ("�" "{\\\\P}") 641 ("�" "{\\\\S}") 642 ("�" "{?`}") 643 ("�" "{!`}") 644 ) 645 "Translation table for translating ISO 8859-1 characters to German TeX.") 646 647;;;###autoload 648(defun iso-gtex2iso (from to &optional buffer) 649 "Translate German TeX sequences to ISO 8859-1 characters. 650The region between FROM and TO is translated using the table TRANS-TAB. 651Optional arg BUFFER is ignored (for use in `format-alist')." 652 (interactive "*r") 653 (iso-translate-conventions from to iso-gtex2iso-trans-tab)) 654 655;;;###autoload 656(defun iso-iso2gtex (from to &optional buffer) 657 "Translate ISO 8859-1 characters to German TeX sequences. 658The region between FROM and TO is translated using the table TRANS-TAB. 659Optional arg BUFFER is ignored (for use in `format-alist')." 660 (interactive "*r") 661 (iso-translate-conventions from to iso-iso2gtex-trans-tab)) 662 663(defvar iso-iso2duden-trans-tab 664 '(("�" "ae") 665 ("�" "Ae") 666 ("�" "oe") 667 ("�" "Oe") 668 ("�" "ue") 669 ("�" "Ue") 670 ("�" "ss"))) 671 672;;;###autoload 673(defun iso-iso2duden (from to &optional buffer) 674 "Translate ISO 8859-1 characters to German TeX sequences. 675The region between FROM and TO is translated using the table TRANS-TAB. 676Optional arg BUFFER is ignored (for use in `format-alist')." 677 (interactive "*r") 678 (iso-translate-conventions from to iso-iso2duden-trans-tab)) 679 680(defvar iso-iso2sgml-trans-tab 681 '(("�" "À") 682 ("�" "Á") 683 ("�" "Â") 684 ("�" "Ã") 685 ("�" "Ä") 686 ("�" "Å") 687 ("�" "Æ") 688 ("�" "Ç") 689 ("�" "È") 690 ("�" "É") 691 ("�" "Ê") 692 ("�" "Ë") 693 ("�" "Ì") 694 ("�" "Í") 695 ("�" "Î") 696 ("�" "Ï") 697 ("�" "Ð") 698 ("�" "Ñ") 699 ("�" "Ò") 700 ("�" "Ó") 701 ("�" "Ô") 702 ("�" "Õ") 703 ("�" "Ö") 704 ("�" "Ø") 705 ("�" "Ù") 706 ("�" "Ú") 707 ("�" "Û") 708 ("�" "Ü") 709 ("�" "Ý") 710 ("�" "Þ") 711 ("�" "ß") 712 ("�" "à") 713 ("�" "á") 714 ("�" "â") 715 ("�" "ã") 716 ("�" "ä") 717 ("�" "å") 718 ("�" "æ") 719 ("�" "ç") 720 ("�" "è") 721 ("�" "é") 722 ("�" "ê") 723 ("�" "ë") 724 ("�" "ì") 725 ("�" "í") 726 ("�" "î") 727 ("�" "ï") 728 ("�" "ð") 729 ("�" "ñ") 730 ("�" "ò") 731 ("�" "ó") 732 ("�" "ô") 733 ("�" "õ") 734 ("�" "ö") 735 ("�" "ø") 736 ("�" "ù") 737 ("�" "ú") 738 ("�" "û") 739 ("�" "ü") 740 ("�" "ý") 741 ("�" "þ") 742 ("�" "ÿ"))) 743 744(defvar iso-sgml2iso-trans-tab 745 '(("À" "�") 746 ("Á" "�") 747 ("Â" "�") 748 ("Ã" "�") 749 ("Ä" "�") 750 ("Å" "�") 751 ("Æ" "�") 752 ("Ç" "�") 753 ("È" "�") 754 ("É" "�") 755 ("Ê" "�") 756 ("Ë" "�") 757 ("Ì" "�") 758 ("Í" "�") 759 ("Î" "�") 760 ("Ï" "�") 761 ("Ð" "�") 762 ("Ñ" "�") 763 ("Ò" "�") 764 ("Ó" "�") 765 ("Ô" "�") 766 ("Õ" "�") 767 ("Ö" "�") 768 ("Ø" "�") 769 ("Ù" "�") 770 ("Ú" "�") 771 ("Û" "�") 772 ("Ü" "�") 773 ("Ý" "�") 774 ("Þ" "�") 775 ("ß" "�") 776 ("à" "�") 777 ("á" "�") 778 ("â" "�") 779 ("ã" "�") 780 ("ä" "�") 781 ("å" "�") 782 ("æ" "�") 783 ("ç" "�") 784 ("è" "�") 785 ("é" "�") 786 ("ê" "�") 787 ("ë" "�") 788 ("ì" "�") 789 ("í" "�") 790 ("î" "�") 791 ("ï" "�") 792 ("ð" "�") 793 ("ñ" "�") 794 (" " "�") 795 ("ò" "�") 796 ("ó" "�") 797 ("ô" "�") 798 ("õ" "�") 799 ("ö" "�") 800 ("ø" "�") 801 ("ù" "�") 802 ("ú" "�") 803 ("û" "�") 804 ("ü" "�") 805 ("ý" "�") 806 ("þ" "�") 807 ("ÿ" "�"))) 808 809;;;###autoload 810(defun iso-iso2sgml (from to &optional buffer) 811 "Translate ISO 8859-1 characters in the region to SGML entities. 812The entities used are from \"ISO 8879:1986//ENTITIES Added Latin 1//EN\". 813Optional arg BUFFER is ignored (for use in `format-alist')." 814 (interactive "*r") 815 (iso-translate-conventions from to iso-iso2sgml-trans-tab)) 816 817;;;###autoload 818(defun iso-sgml2iso (from to &optional buffer) 819 "Translate SGML entities in the region to ISO 8859-1 characters. 820The entities used are from \"ISO 8879:1986//ENTITIES Added Latin 1//EN\". 821Optional arg BUFFER is ignored (for use in `format-alist')." 822 (interactive "*r") 823 (iso-translate-conventions from to iso-sgml2iso-trans-tab)) 824 825;;;###autoload 826(defun iso-cvt-read-only (&rest ignore) 827 "Warn that format is read-only." 828 (interactive) 829 (error "This format is read-only; specify another format for writing")) 830 831;;;###autoload 832(defun iso-cvt-write-only (&rest ignore) 833 "Warn that format is write-only." 834 (interactive) 835 (error "This format is write-only")) 836 837;;;###autoload 838(defun iso-cvt-define-menu () 839 "Add submenus to the File menu, to convert to and from various formats." 840 (interactive) 841 842 (let ((load-as-menu-map (make-sparse-keymap "Load As...")) 843 (insert-as-menu-map (make-sparse-keymap "Insert As...")) 844 (write-as-menu-map (make-sparse-keymap "Write As...")) 845 (translate-to-menu-map (make-sparse-keymap "Translate to...")) 846 (translate-from-menu-map (make-sparse-keymap "Translate from...")) 847 (menu menu-bar-file-menu)) 848 849 (define-key menu [load-as-separator] '("--")) 850 851 (define-key menu [load-as] '("Load As..." . iso-cvt-load-as)) 852 (fset 'iso-cvt-load-as load-as-menu-map) 853 854 ;;(define-key menu [insert-as] '("Insert As..." . iso-cvt-insert-as)) 855 (fset 'iso-cvt-insert-as insert-as-menu-map) 856 857 (define-key menu [write-as] '("Write As..." . iso-cvt-write-as)) 858 (fset 'iso-cvt-write-as write-as-menu-map) 859 860 (define-key menu [translate-separator] '("--")) 861 862 (define-key menu [translate-to] '("Translate to..." . iso-cvt-translate-to)) 863 (fset 'iso-cvt-translate-to translate-to-menu-map) 864 865 (define-key menu [translate-from] '("Translate from..." . iso-cvt-translate-from)) 866 (fset 'iso-cvt-translate-from translate-from-menu-map) 867 868 (dolist (file-type (reverse format-alist)) 869 (let ((name (car file-type)) 870 (str-name (cadr file-type))) 871 (if (stringp str-name) 872 (progn 873 (define-key load-as-menu-map (vector name) 874 (cons str-name 875 `(lambda (file) 876 (interactive ,(format "FFind file (as %s): " name)) 877 (format-find-file file ',name)))) 878 (define-key insert-as-menu-map (vector name) 879 (cons str-name 880 `(lambda (file) 881 (interactive (format "FInsert file (as %s): " ,name)) 882 (format-insert-file file ',name)))) 883 (define-key write-as-menu-map (vector name) 884 (cons str-name 885 `(lambda (file) 886 (interactive (format "FWrite file (as %s): " ,name)) 887 (format-write-file file ',name)))) 888 (define-key translate-to-menu-map (vector name) 889 (cons str-name 890 `(lambda () 891 (interactive) 892 (format-encode-buffer ',name)))) 893 (define-key translate-from-menu-map (vector name) 894 (cons str-name 895 `(lambda () 896 (interactive) 897 (format-decode-buffer ',name)))))))))) 898 899(provide 'iso-cvt) 900 901;; arch-tag: 64ae843f-ed0e-43e1-ba50-ffd581b90840 902;;; iso-cvt.el ends here 903