diff options
| author | Dave Love | 1998-08-05 18:41:26 +0000 |
|---|---|---|
| committer | Dave Love | 1998-08-05 18:41:26 +0000 |
| commit | 575f522f3a3c45d15f1f792c327341f9c2d4d6ac (patch) | |
| tree | bedd5f3fdf05286a44f6f518122587d2e6b184c8 | |
| parent | 08b59cd3332c5531f614b6c0394cdab001ba047d (diff) | |
| download | emacs-575f522f3a3c45d15f1f792c327341f9c2d4d6ac.tar.gz emacs-575f522f3a3c45d15f1f792c327341f9c2d4d6ac.zip | |
(iso-spanish, iso-german, iso-iso2tex,
iso-tex2iso, iso-gtex2iso, iso-iso2gtex, iso-iso2duden): Add
optional (but ignored) arg `buffer' for format-{de,en}code. Doc
fix. Add * to interactive spec. Add autoload cookie.
(iso-cvt-read-only, iso-cvt-write-only): Add doc, autoload cookie.
(iso-cvt-define-menu): Add autoload cookie.
| -rw-r--r-- | lisp/international/iso-cvt.el | 117 |
1 files changed, 72 insertions, 45 deletions
diff --git a/lisp/international/iso-cvt.el b/lisp/international/iso-cvt.el index 10022fd5698..a862a89bdd1 100644 --- a/lisp/international/iso-cvt.el +++ b/lisp/international/iso-cvt.el | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | ;;; iso-cvt.-el -- translate ISO 8859-1 from/to various encodings | 1 | ;;; iso-cvt.-el -- translate ISO 8859-1 from/to various encodings |
| 2 | ;; This file was formerly called gm-lingo.el. | 2 | ;; This file was formerly called gm-lingo.el. |
| 3 | 3 | ||
| 4 | ;; Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc. | 4 | ;; Copyright (C) 1993, 1994, 1995, 1996, 1998 Free Software Foundation, Inc. |
| 5 | 5 | ||
| 6 | ;; Author: Michael Gschwind <mike@vlsivie.tuwien.ac.at> | 6 | ;; Author: Michael Gschwind <mike@vlsivie.tuwien.ac.at> |
| 7 | ;; Keywords: tex, iso, latin, i18n | 7 | ;; Keywords: tex, iso, latin, i18n |
| @@ -23,11 +23,11 @@ | |||
| 23 | ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 23 | ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
| 24 | ;; Boston, MA 02111-1307, USA. | 24 | ;; Boston, MA 02111-1307, USA. |
| 25 | 25 | ||
| 26 | ;;; Commentary: | 26 | ;;; Commentary: |
| 27 | ;; This lisp code is a general framework for translating various | 27 | ;; This lisp code is a general framework for translating various |
| 28 | ;; representations of the same data. | 28 | ;; representations of the same data. |
| 29 | ;; among other things it can be used to translate TeX, HTML, and compressed | 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 | 30 | ;; files to ISO 8859-1. It can also be used to translate different charsets |
| 31 | ;; such as IBM PC, Macintosh or HP Roman8. | 31 | ;; such as IBM PC, Macintosh or HP Roman8. |
| 32 | ;; Note that many translations use the GNU recode tool to do the actual | 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 | 33 | ;; conversion. So you might want to install that tool to get the full |
| @@ -35,13 +35,13 @@ | |||
| 35 | ; | 35 | ; |
| 36 | 36 | ||
| 37 | ; TO DO: | 37 | ; TO DO: |
| 38 | ; Cover more cases for translation (There is an infinite number of ways to | 38 | ; Cover more cases for translation (There is an infinite number of ways to |
| 39 | ; represent accented characters in TeX) | 39 | ; represent accented characters in TeX) |
| 40 | 40 | ||
| 41 | ;; SEE ALSO: | 41 | ;; SEE ALSO: |
| 42 | ; If you are interested in questions related to using the ISO 8859-1 | 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 | 43 | ; characters set (configuring emacs, Unix, etc. to use ISO), then you |
| 44 | ; can get the ISO 8859-1 FAQ via anonymous ftp from | 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 | 45 | ; ftp.vlsivie.tuwien.ac.at in /pub/bit/FAQ-ISO-8859-1 |
| 46 | 46 | ||
| 47 | ;;; Code: | 47 | ;;; Code: |
| @@ -84,9 +84,13 @@ | |||
| 84 | (setq work-tab (cdr work-tab))))) | 84 | (setq work-tab (cdr work-tab))))) |
| 85 | (point-max)))) | 85 | (point-max)))) |
| 86 | 86 | ||
| 87 | (defun iso-spanish (from to) | 87 | ;;;###autoload |
| 88 | "Translate net conventions for Spanish to ISO 8859-1 in region." | 88 | (defun iso-spanish (from to &optional buffer) |
| 89 | (interactive "r") | 89 | "Translate net conventions for Spanish to ISO 8859-1. |
| 90 | The region between FROM and TO is translated using the table TRANS-TAB. | ||
| 91 | Optional arg BUFFER is ignored (so that the function can can be used in | ||
| 92 | `format-alist')." | ||
| 93 | (interactive "*r") | ||
| 90 | (iso-translate-conventions from to iso-spanish-trans-tab)) | 94 | (iso-translate-conventions from to iso-spanish-trans-tab)) |
| 91 | 95 | ||
| 92 | (defvar iso-aggressive-german-trans-tab | 96 | (defvar iso-aggressive-german-trans-tab |
| @@ -100,7 +104,7 @@ | |||
| 100 | ("\"s" "ß") | 104 | ("\"s" "ß") |
| 101 | ("\\\\3" "ß") | 105 | ("\\\\3" "ß") |
| 102 | ) | 106 | ) |
| 103 | "German translation table. | 107 | "German translation table. |
| 104 | This table uses an aggressive translation approach and may erroneously | 108 | This table uses an aggressive translation approach and may erroneously |
| 105 | translate too much.") | 109 | translate too much.") |
| 106 | 110 | ||
| @@ -116,16 +120,19 @@ translate too much.") | |||
| 116 | ("\\([-a-zA-Z\"`]\\)\\\\3" "\\1ß") | 120 | ("\\([-a-zA-Z\"`]\\)\\\\3" "\\1ß") |
| 117 | ) | 121 | ) |
| 118 | "German translation table. | 122 | "German translation table. |
| 119 | This table uses a conservative translation approach and may translate too | 123 | This table uses a conservative translation approach and may translate too |
| 120 | little.") | 124 | little.") |
| 121 | 125 | ||
| 122 | 126 | (defvar iso-german-trans-tab iso-aggressive-german-trans-tab | |
| 123 | (defvar iso-german-trans-tab iso-aggressive-german-trans-tab | ||
| 124 | "Currently active translation table for German.") | 127 | "Currently active translation table for German.") |
| 125 | 128 | ||
| 126 | (defun iso-german (from to) | 129 | ;;;###autoload |
| 127 | "Translate net conventions for German to ISO 8859-1 in region." | 130 | (defun iso-german (from to &optional buffer) |
| 128 | (interactive "r") | 131 | "Translate net conventions for German to ISO 8859-1. |
| 132 | The region between FROM and TO is translated using the table TRANS-TAB. | ||
| 133 | Optional arg BUFFER is ignored (so that the function can can be used in | ||
| 134 | `format-alist')." | ||
| 135 | (interactive "*r") | ||
| 129 | (iso-translate-conventions from to iso-german-trans-tab)) | 136 | (iso-translate-conventions from to iso-german-trans-tab)) |
| 130 | 137 | ||
| 131 | (defvar iso-iso2tex-trans-tab | 138 | (defvar iso-iso2tex-trans-tab |
| @@ -192,15 +199,15 @@ little.") | |||
| 192 | ) | 199 | ) |
| 193 | "Translation table for translating ISO 8859-1 characters to TeX sequences.") | 200 | "Translation table for translating ISO 8859-1 characters to TeX sequences.") |
| 194 | 201 | ||
| 195 | 202 | ;;;###autoload | |
| 196 | 203 | (defun iso-iso2tex (from to &optional buffer) | |
| 197 | 204 | "Translate ISO 8859-1 characters to TeX sequences. | |
| 198 | (defun iso-iso2tex (from to) | 205 | The region between FROM and TO is translated using the table TRANS-TAB. |
| 199 | "Translate ISO 8859-1 characters to TeX sequences in region." | 206 | Optional arg BUFFER is ignored (so that the function can can be used in |
| 200 | (interactive "r") | 207 | `format-alist')." |
| 208 | (interactive "*r") | ||
| 201 | (iso-translate-conventions from to iso-iso2tex-trans-tab)) | 209 | (iso-translate-conventions from to iso-iso2tex-trans-tab)) |
| 202 | 210 | ||
| 203 | |||
| 204 | (defvar iso-tex2iso-trans-tab | 211 | (defvar iso-tex2iso-trans-tab |
| 205 | '( | 212 | '( |
| 206 | ("{\\\\\"a}" "ä") | 213 | ("{\\\\\"a}" "ä") |
| @@ -375,13 +382,17 @@ little.") | |||
| 375 | ("\\?`" "¿") | 382 | ("\\?`" "¿") |
| 376 | ("!`" "¡") | 383 | ("!`" "¡") |
| 377 | ) | 384 | ) |
| 378 | "Translation table for translating TeX sequences to ISO 8859-1 characters. | 385 | "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 | 386 | This table is not exhaustive (and due to TeX's power can never be). It only |
| 380 | contains commonly used sequences.") | 387 | contains commonly used sequences.") |
| 381 | 388 | ||
| 382 | (defun iso-tex2iso (from to) | 389 | ;;;###autoload |
| 383 | "Translate TeX sequences to ISO 8859-1 characters in region." | 390 | (defun iso-tex2iso (from to &optional buffer) |
| 384 | (interactive "r") | 391 | "Translate TeX sequences to ISO 8859-1 characters. |
| 392 | The region between FROM and TO is translated using the table TRANS-TAB. | ||
| 393 | Optional arg BUFFER is ignored (so that the function can can be used in | ||
| 394 | `format-alist')." | ||
| 395 | (interactive "*r") | ||
| 385 | (iso-translate-conventions from to iso-tex2iso-trans-tab)) | 396 | (iso-translate-conventions from to iso-tex2iso-trans-tab)) |
| 386 | 397 | ||
| 387 | (defvar iso-gtex2iso-trans-tab | 398 | (defvar iso-gtex2iso-trans-tab |
| @@ -634,15 +645,22 @@ contains commonly used sequences.") | |||
| 634 | ) | 645 | ) |
| 635 | "Translation table for translating ISO 8859-1 characters to German TeX.") | 646 | "Translation table for translating ISO 8859-1 characters to German TeX.") |
| 636 | 647 | ||
| 637 | (defun iso-gtex2iso (from to) | 648 | ;;;###autoload |
| 638 | "Translate German TeX sequences to ISO 8859-1 characters in region." | 649 | (defun iso-gtex2iso (from to &optional buffer) |
| 639 | (interactive "r") | 650 | "Translate German TeX sequences to ISO 8859-1 characters. |
| 651 | The region between FROM and TO is translated using the table TRANS-TAB. | ||
| 652 | Optional arg BUFFER is ignored (so that the function can can be used in | ||
| 653 | `format-alist')." | ||
| 654 | (interactive "*r") | ||
| 640 | (iso-translate-conventions from to iso-gtex2iso-trans-tab)) | 655 | (iso-translate-conventions from to iso-gtex2iso-trans-tab)) |
| 641 | 656 | ||
| 642 | 657 | ;;;###autoload | |
| 643 | (defun iso-iso2gtex (from to) | 658 | (defun iso-iso2gtex (from to &optional buffer) |
| 644 | "Translate ISO 8859-1 characters to German TeX sequences in region." | 659 | "Translate ISO 8859-1 characters to German TeX sequences. |
| 645 | (interactive "r") | 660 | The region between FROM and TO is translated using the table TRANS-TAB. |
| 661 | Optional arg BUFFER is ignored (so that the function can can be used in | ||
| 662 | `format-alist')." | ||
| 663 | (interactive "*r") | ||
| 646 | (iso-translate-conventions from to iso-iso2gtex-trans-tab)) | 664 | (iso-translate-conventions from to iso-iso2gtex-trans-tab)) |
| 647 | 665 | ||
| 648 | (defvar iso-iso2duden-trans-tab | 666 | (defvar iso-iso2duden-trans-tab |
| @@ -654,19 +672,28 @@ contains commonly used sequences.") | |||
| 654 | ("Ü" "Ue") | 672 | ("Ü" "Ue") |
| 655 | ("ß" "ss"))) | 673 | ("ß" "ss"))) |
| 656 | 674 | ||
| 657 | (defun iso-iso2duden (from to) | 675 | ;;;###autoload |
| 658 | "Translate ISO 8859-1 characters to German TeX sequences in region." | 676 | (defun iso-iso2duden (from to &optional buffer) |
| 659 | (interactive "r") | 677 | "Translate ISO 8859-1 characters to German TeX sequences. |
| 678 | The region between FROM and TO is translated using the table TRANS-TAB. | ||
| 679 | Optional arg BUFFER is ignored (so that the function can can be used in | ||
| 680 | `format-alist')." | ||
| 681 | (interactive "*r") | ||
| 660 | (iso-translate-conventions from to iso-iso2duden-trans-tab)) | 682 | (iso-translate-conventions from to iso-iso2duden-trans-tab)) |
| 661 | 683 | ||
| 684 | ;;;###autoload | ||
| 662 | (defun iso-cvt-read-only () | 685 | (defun iso-cvt-read-only () |
| 686 | "Warn that format is read-only." | ||
| 663 | (interactive) | 687 | (interactive) |
| 664 | (error "This format is read-only; specify another format for writing")) | 688 | (error "This format is read-only; specify another format for writing")) |
| 665 | 689 | ||
| 690 | ;;;###autoload | ||
| 666 | (defun iso-cvt-write-only () | 691 | (defun iso-cvt-write-only () |
| 692 | "Warn that format is write-only." | ||
| 667 | (interactive) | 693 | (interactive) |
| 668 | (error "This format is write-only")) | 694 | (error "This format is write-only")) |
| 669 | 695 | ||
| 696 | ;;;###autoload | ||
| 670 | (defun iso-cvt-define-menu () | 697 | (defun iso-cvt-define-menu () |
| 671 | "Add submenus to the Files menu, to convert to and from various formats." | 698 | "Add submenus to the Files menu, to convert to and from various formats." |
| 672 | (interactive) | 699 | (interactive) |
| @@ -698,30 +725,30 @@ contains commonly used sequences.") | |||
| 698 | (let ((file-types (reverse format-alist)) | 725 | (let ((file-types (reverse format-alist)) |
| 699 | name | 726 | name |
| 700 | str-name) | 727 | str-name) |
| 701 | (while file-types | 728 | (while file-types |
| 702 | (setq name (car (car file-types)) | 729 | (setq name (car (car file-types)) |
| 703 | str-name (car (cdr (car file-types))) | 730 | str-name (car (cdr (car file-types))) |
| 704 | file-types (cdr file-types)) | 731 | file-types (cdr file-types)) |
| 705 | (if (stringp str-name) | 732 | (if (stringp str-name) |
| 706 | (progn | 733 | (progn |
| 707 | (define-key load-as-menu-map (vector name) | 734 | (define-key load-as-menu-map (vector name) |
| 708 | (cons str-name | 735 | (cons str-name |
| 709 | (list 'lambda '(file) (list 'interactive (format "FFind file (as %s): " name)) | 736 | (list 'lambda '(file) (list 'interactive (format "FFind file (as %s): " name)) |
| 710 | (list 'format-find-file 'file (list 'quote name))))) | 737 | (list 'format-find-file 'file (list 'quote name))))) |
| 711 | (define-key insert-as-menu-map (vector name) | 738 | (define-key insert-as-menu-map (vector name) |
| 712 | (cons str-name | 739 | (cons str-name |
| 713 | (list 'lambda '(file) (list 'interactive (format "FInsert file (as %s): " name)) | 740 | (list 'lambda '(file) (list 'interactive (format "FInsert file (as %s): " name)) |
| 714 | (list 'format-insert-file 'file (list 'quote name))))) | 741 | (list 'format-insert-file 'file (list 'quote name))))) |
| 715 | (define-key write-as-menu-map (vector name) | 742 | (define-key write-as-menu-map (vector name) |
| 716 | (cons str-name | 743 | (cons str-name |
| 717 | (list 'lambda '(file) (list 'interactive (format "FWrite file (as %s): " name)) | 744 | (list 'lambda '(file) (list 'interactive (format "FWrite file (as %s): " name)) |
| 718 | (list 'format-write-file 'file (list 'quote (list name)))))) | 745 | (list 'format-write-file 'file (list 'quote (list name)))))) |
| 719 | (define-key translate-to-menu-map (vector name) | 746 | (define-key translate-to-menu-map (vector name) |
| 720 | (cons str-name | 747 | (cons str-name |
| 721 | (list 'lambda '() '(interactive) | 748 | (list 'lambda '() '(interactive) |
| 722 | (list 'format-encode-buffer (list 'quote name))))) | 749 | (list 'format-encode-buffer (list 'quote name))))) |
| 723 | (define-key translate-from-menu-map (vector name) | 750 | (define-key translate-from-menu-map (vector name) |
| 724 | (cons str-name | 751 | (cons str-name |
| 725 | (list 'lambda '() '(interactive) | 752 | (list 'lambda '() '(interactive) |
| 726 | (list 'format-decode-buffer (list 'quote (list name)))))) | 753 | (list 'format-decode-buffer (list 'quote (list name)))))) |
| 727 | ))))) | 754 | ))))) |