]> code.delx.au - gnu-emacs/blobdiff - lisp/language/european.el
Merge from emacs--devo--0
[gnu-emacs] / lisp / language / european.el
index 3da1850a7186568fdd2e6ee194ddd97eb1b03960..b7532eb1a47420b597e31d6c80a590d4aac5dc65 100644 (file)
@@ -1,8 +1,11 @@
 ;;; european.el --- support for European languages -*- coding: iso-2022-7bit; -*-
 
-;; Copyright (C) 1995, 1997, 2001 Electrotechnical Laboratory, JAPAN.
-;;   Licensed to the Free Software Foundation.
-;; Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
+;;   Free Software Foundation, Inc.
+;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+;;   2005, 2006, 2007
+;;   National Institute of Advanced Industrial Science and Technology (AIST)
+;;   Registration Number H14PRO021
 ;; Copyright (C) 2003
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
 ;;   Registration Number H13PRO009
@@ -23,8 +26,8 @@
 
 ;; You should have received a copy of the GNU General Public License
 ;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
 
 ;;; Commentary:
 
@@ -43,7 +46,7 @@
             (unibyte-display . iso-latin-1)
             (input-method . "latin-1-prefix")
             (sample-text
-             . "Hello, Hej, Tere, Hei, Bonjour, Gr\e,A|_\e(B Gott, Ciao, \e,A!\e(BHola!")
+             . "Hello, Hej, Tere, Hei, Bonjour, Gr\e$(D+d)N\e(B Gott, Ciao, \e$(D"B\e(BHola!")
             (documentation . "\
 This language environment is a generic one for the Latin-1 (ISO-8859-1)
 character set which supports the following European languages:
@@ -241,7 +244,7 @@ See also the Turkish environment."))
             (unibyte-display . iso-latin-8)
             (input-method . "latin-8-prefix")
             ;; Fixme: Welsh/Ga{e}lic greetings
-            (sample-text . "\e,_"\e(B \e,_p\e(B \e,_^\e(B")
+            (sample-text . "\e,_"\e(B \e$(D+q\e(B \e$(D*t\e(B")
             (documentation . "\
 This language environment is a generic one for the Latin-8 (ISO-8859-14)
 character set which supports the Celtic languages, including those not
@@ -271,7 +274,7 @@ covered by other ISO-8859 character sets:
             (unibyte-display . iso-latin-9)
             (input-method . "latin-9-prefix")
             (sample-text
-             . "AVE. \e,B)9.>\e,b<=\e,_/\e(B \e,b$\e(B")
+             . "AVE. \e$(D*^+^*v+v)-)M*s\e(B \e$(Q)!\e(B")
             (documentation . "\
 This language environment is a generic one for the Latin-9 (ISO-8859-15)
 character set which supports the same languages as Latin-1 with the
@@ -406,7 +409,7 @@ but it selects the Dutch tutorial and input method."))
            (unibyte-display . iso-latin-1)
            (sample-text . "\
 German (Deutsch Nord)  Guten Tag
-German (Deutsch S\e,A|\e(Bd)     Gr\e,A|_\e(B Gott")
+German (Deutsch S\e$(D+d\e(Bd)   Gr\e$(D+d)N\e(B Gott")
            (documentation . "\
 This language environment is almost the same as Latin-1,
 but sets the default input method to \"german-postfix\".
@@ -421,7 +424,7 @@ Additionally, it selects the German tutorial."))
            (nonascii-translation . iso-8859-1)
            (unibyte-display . iso-latin-1)
            (input-method . "latin-1-prefix")
-           (sample-text . "French (Fran\e,Ag\e(Bais)     Bonjour, Salut")
+           (sample-text . "French (Fran\e$(D+.\e(Bais)   Bonjour, Salut")
            (documentation . "\
 This language environment is almost the same as Latin-1,
 but it selects the French tutorial and input method."))
@@ -450,7 +453,7 @@ Additionally, it selects the Italian tutorial."))
              (input-method . "slovenian")
              (unibyte-display . iso-8859-2)
              (tutorial . "TUTORIAL.sl")
-             (sample-text . "\e,B.\e(Belimo vam uspe\e,B9\e(Ben dan!")
+             (sample-text . "\e$(D*v\e(Belimo vam uspe\e$(D+^\e(Ben dan!")
              (documentation . "\
 This language environment is almost the same as Latin-2,
 but it selects the Slovenian tutorial and input method."))
@@ -464,7 +467,7 @@ but it selects the Slovenian tutorial and input method."))
            (input-method . "spanish-postfix")
            (nonascii-translation . iso-8859-1)
            (unibyte-display . iso-latin-1)
-           (sample-text . "Spanish (Espa\e,Aq\e(Bol)     \e,A!\e(BHola!")
+           (sample-text . "Spanish (Espa\e$(D+P\e(Bol)   \e$(D"B\e(BHola!")
            (documentation . "\
 This language environment is almost the same as Latin-1,
 but it sets the default input method to \"spanish-postfix\",
@@ -483,19 +486,25 @@ and it selects the Spanish tutorial."))
             (nonascii-translation . iso-8859-9)
             (unibyte-display . iso-latin-5)
             (input-method . "turkish-postfix")
-            (sample-text . "Turkish (T\e,A|\e(Brk\e,Ag\e(Be)       Merhaba")
-            (setup-function
-             . (lambda ()
-                 (set-case-syntax-pair ?I ?\e,C9\e(B (standard-case-table))
-                 (set-case-syntax-pair ?\e,C)\e(B ?i (standard-case-table))))
-            (exit-function
-             . (lambda ()
-                 (set-case-syntax-pair ?I ?i (standard-case-table))
-                 (set-case-syntax ?\e,C9\e(B "w" (standard-case-table))
-                 (set-case-syntax ?\e,C)\e(B "w" (standard-case-table))))
+            (sample-text . "Turkish (T\e$(D+d\e(Brk\e$(D+.\e(Be)   Merhaba")
+            (setup-function . turkish-case-conversion-enable)
+            (setup-function . turkish-case-conversion-disable)
             (documentation . "Support for Turkish.
 Differs from the Latin-5 environment in using the `turkish-postfix' input
-method and applying Turkish case rules for the characters i, I, \e,C9\e(B, \e,C)\e(B.")))
+method and applying Turkish case rules for the characters i, I, \e$(D)E\e(B, \e$(D*D\e(B.")))
+
+(defun turkish-case-conversion-enable ()
+  "Set up Turkish case conversion of `i' and `I' into `\e$(D*D\e(B' and `\e$(D)E\e(B'."
+  (let ((table (standard-case-table)))
+    (set-case-syntax-pair ?\e$(D*D\e(B ?i table)
+    (set-case-syntax-pair ?I ?\e$(D)E\e(B table)))
+
+(defun turkish-case-conversion-disable ()
+  "Set up normal (non-Turkish) case conversion of `i' into `I'."
+  (let ((table (standard-case-table)))
+    (set-case-syntax-pair ?I ?i table)
+    (set-case-syntax ?\e$(D*D\e(B "w" table)
+    (set-case-syntax ?\e$(D)E\e(B "w" table)))
 
 ;; Polish ISO 8859-2 environment.
 ;; Maintainer: Wlodek Bzyl <matwb@univ.gda.pl>
@@ -509,7 +518,7 @@ method and applying Turkish case rules for the characters i, I, \e,C9\e(B, \e,C)\e(B
           (nonascii-translation . iso-8859-2)
           (unibyte-display . iso-8859-2)
           (tutorial . "TUTORIAL.pl")
-          (sample-text . "P\e,As\e(Bjd\e,B<\e(B, ki\e,Bq\e(B-\e,B?\e(Be t\e,Bj\e(B chmurno\e,B6f\e(B w g\e,B31\e(Bb flaszy")
+          (sample-text . "P\e$(D+Q\e(Bjd\e$(D+u\e(B, ki\e$(D+M\e(B-\e$(D+w\e(Be t\e$(D+8\e(B chmurno\e$(D+\++\e(B w g\e$(D)H+(\e(Bb flaszy")
           (documentation . t))
  '("European"))
 
@@ -575,6 +584,18 @@ method and applying Turkish case rules for the characters i, I, \e,C9\e(B, \e,C)\e(B
              (documentation . "Support for Croatian with Latin-2 encoding."))
  '("European"))
 
+(set-language-info-alist
+ "Brazilian Portuguese" '((tutorial . "TUTORIAL.pt_BR")
+           (charset iso-8859-1)
+           (coding-system iso-latin-1 iso-latin-9)
+           (coding-priority iso-latin-1)
+           (nonascii-translation . iso-8859-1)
+           (unibyte-display . iso-8859-1)
+           (input-method . "latin-1-prefix")
+           (sample-text . "Oi")
+           (documentation . "Support for Brazilian Portuguese."))
+ '("European"))
+
 \f
 (define-coding-system 'mac-roman
   "Mac Roman Encoding (MIME:MACINTOSH)."
@@ -657,13 +678,15 @@ positions (integers or markers) specifying the region."
     (narrow-to-region beg end)
     (goto-char (point-min))
     (while (re-search-forward diacritic-composition-pattern nil t)
-      (compose-region (match-beginning 0) (match-end 0)))))
+      (if (= (char-syntax (char-after (match-beginning 0))) ?w)
+         (compose-region (match-beginning 0) (match-end 0))))))
 
 (defun diacritic-compose-string (string)
   "Compose diacritic characters in STRING and return the resulting string."
   (let ((idx 0))
     (while (setq idx (string-match diacritic-composition-pattern string idx))
-      (compose-string string idx (match-end 0))
+      (if (= (char-syntax (aref string idx)) ?w)
+         (compose-string string idx (match-end 0)))
       (setq idx (match-end 0))))
   string)
 
@@ -672,10 +695,6 @@ positions (integers or markers) specifying the region."
   (interactive)
   (diacritic-compose-region (point-min) (point-max)))
 
-(defun diacritic-post-read-conversion (len)
-  (diacritic-compose-region (point) (+ (point) len))
-  len)
-
 (defun diacritic-composition-function (pos &optional string)
   "Compose diacritic text around POS.
 Optional 2nd argument STRING, if non-nil, is a string containing text
@@ -688,7 +707,7 @@ or nil if no characters are composed."
       (if (>= pos 0)
          (let ((ch (aref string pos))
                start end components ch composition)
-           (when (and (>= ch 32) (or (< ch 127) (>= ch 160)))
+           (when (= (char-syntax ch) ?w)
              (setq start pos
                    end (length string)
                    components (list ch)
@@ -706,7 +725,7 @@ or nil if no characters are composed."
     (if (>= pos (point-min))
        (let ((ch (char-after pos))
              start end components composition)
-         (when (and (>= ch 32) (or (< ch 127) (>= ch 160)))
+         (when (= (char-syntax ch) ?w)
            (setq start pos
                  end (point-max)
                  components (list ch)