Commits

Anonymous committed 7b130e7

Specify safe-charsets when possible and needed, latin-euro-standards.

  • Participants
  • Parent commits 733b723

Comments (0)

Files changed (5)

+2009-07-21  Aidan Kehoe  <kehoea@parhasard.net>
+
+	* latin-euro-latin10.el (find-charset): 
+	Stop pretending to support versions < 21.4. 
+	Stop loading cl-macs from this file (and hence, from
+	auto-autoloads.elc), it's needed at compile time, not run time.
+	Move to loop syntax instead of mapc + lambda.
+	Avoid some needless version workarounds. 
+	* latin-euro-latin7.el (latin-euro-recognize-safe-charsets): 
+	New variable, describing whether this XEmacs supports the
+	`safe-charsets' #'make-coding-system parameter. 
+	* latin-euro-latin7.el (find-charset): 
+	Same approach as in -latin10.el, no support for < 21.4; no
+	explicit load of cl-macs, loop syntax instead of mapc + lambda,
+	avoid needless version workarounds.
+	* latin-euro-latin7.el (find-coding-system): 
+	Specify the `safe-charsets' parameter if we can, avoiding test
+	`query-coding-region' test failures in the trunk.
+	Avoid some needless compatibility measures. 
+	* latin-euro-latin8.el:
+	Same work as in `latin-euro-latin7.el'
+
 2007-12-25  Norbert Koch  <viteno@xemacs.org>
 
 	* Makefile (VERSION): XEmacs package 1.08 released.

File latin-euro-latin10.el

   ;; Create character set
   (make-charset
    'latin-iso8859-16 "ISO8859-16 (Latin 10)"
-   ;; sheesh, what we do for backward compatibility
-   ;; #### this test and the similar one below probably should be
-   ;; reformulated to use condition-case
-   (append (if (emacs-version>= 21 4)
-	       '(short-name "Latin-10"
-		 long-name "ISO8859-16 (Latin 10)")
-	     nil)
-	   '(registry "iso8859-16"
-	     dimension 1
-	     columns 1
-	     chars 96
-	     final ?f			; octet 06/06; cf ISO-IR 226
-	     graphic 1
-	     direction l2r)))
+   '(short-name "Latin-10"
+     long-name "ISO8859-16 (Latin 10)"
+     registry "iso8859-16"
+     dimension 1
+     columns 1
+     chars 96
+     final ?f			; octet 06/06; cf ISO-IR 226
+     graphic 1
+     direction l2r))
   ;; For syntax of Latin-10 characters.
-  (require 'cl)
-  (load "cl-macs" nil t)
   (loop for c from 64 to 127
     do (modify-syntax-entry (make-char 'latin-iso8859-16 c) "w"))
-  (mapc (lambda (c)
-	  (modify-syntax-entry (make-char 'latin-iso8859-16 c) "w"))
-	'(#xA1 #xA2 #xA3 #xA6 #xA8 #xAA #xAC #xAE #xAF
-	  #xB3 #xB4 #xB5 #xB8 #xB9 #xBA #xBC #xBD #xBE #xBF))
-  )
+  (loop for c in '(#xA1 #xA2 #xA3 #xA6 #xA8 #xAA #xAC #xAE #xAF
+                   #xB3 #xB4 #xB5 #xB8 #xB9 #xBA #xBC #xBD #xBE #xBF)
+    do (modify-syntax-entry (make-char 'latin-iso8859-16 c) "w")))
 
 ;;;###autoload
 (unless (find-coding-system 'iso-8859-16)
-  ;; Create coding system
+  ;; Create coding system. No need for a `safe-charsets' parameter, if an
+  ;; XEmacs can handle that, it has this coding system built in.
   (make-coding-system
    'iso-8859-16 'iso2022 "MIME ISO-8859-16"
    '(charset-g0 ascii
     (set-language-environment "Latin-10"))
 
   ;; sheesh, what we do for backward compatibility
-  (apply #'set-language-info-alist
-	 (append `("Latin-10"
-		   ((charset ascii latin-iso8859-16)
-		    (coding-system iso-8859-16)
-		    (coding-priority iso-8859-16)
-		    (input-method . "latin-10-prefix")
-		    (sample-text
-		     .
-		     ;; #### OK, who knows some Romanian?
-		     ,(format "\
+  (set-language-info-alist
+   "Latin-10"
+   `((charset ascii latin-iso8859-16)
+     (coding-system iso-8859-16)
+     (coding-priority iso-8859-16)
+     (input-method . "latin-10-prefix")
+     (sample-text .
+                  ;; #### OK, who knows some Romanian?
+                  ,(format "\
 Hey, if you know Romanian, send sample encoded text (eg, using \"comma-below\"
 characters) to xemacs-beta@xemacs.org.  Please use a MIME
 application/octet-stream attachment if possible."
-			      ))
-		    (documentation . "\
+                           ))
+     (documentation . "\
 This is a generic language environment for Latin-10 (ISO-8859-16).  It
-supports Romanian and most Western European languages.")))
-		 (if (emacs-version>= 21 1 15)
-		     '(("European"))
-		   nil))))
+supports Romanian and most Western European languages."))
+   '("European")))
 
 (provide 'latin-euro-latin10)
 

File latin-euro-latin7.el

 
 ;;; Code:
 
+(defvar latin-euro-recognize-safe-charsets
+  (condition-case nil
+      (progn
+	(coding-system-property (find-coding-system 'iso-8859-1-unix)
+				'safe-charsets)
+	t)
+    (error nil))
+  "t if this XEmacs understands the `safe-charsets' coding-system property.")
+
 ;; define ISO-8859-13 for XEmacs 21.4 and earlier
-; don't ;;;###autoload
 (unless (find-charset 'latin-iso8859-13)
   ;; Create character set
   (make-charset
    'latin-iso8859-13 "ISO8859-13 (Latin 7)"
-   ;; sheesh, what we do for backward compatibility
-   ;; #### this test and the similar one below probably should be
-   ;; reformulated to use condition-case
-   (append (if (emacs-version>= 21 4)
-	       '(short-name "Latin-7"
-		 long-name "ISO8859-13 (Latin 7)")
-	     nil)
-	   '(registry "iso8859-13"
-	     dimension 1
-	     columns 1
-	     chars 96
-	     final ?Y
-	     graphic 1
-	     direction l2r)))
+   '(short-name "Latin-7"
+     long-name "ISO8859-13 (Latin 7)"
+     registry "iso8859-13"
+     dimension 1
+     columns 1
+     chars 96
+     final ?Y
+     graphic 1
+     direction l2r))
+
   ;; For syntax of Latin-7 characters.
-  (require 'cl)
-  (load "cl-macs" nil t)		; howcum no #'provide?
-  (loop for c from 64 to 127		; from '�' to '�'
+  (loop for c from 64 to 127		; from ',A@(B' to ',A(B'
     do (modify-syntax-entry (make-char 'latin-iso8859-13 c) "w"))
-  (mapc (lambda (c)
-	  (modify-syntax-entry (make-char 'latin-iso8859-13 c) "w"))
-	'(#xA8 #xAA #xAF #xB8 #xBA #xBF))
-  
+  (loop for c in '(#xA8 #xAA #xAF #xB8 #xBA #xBF)
+    do (modify-syntax-entry (make-char 'latin-iso8859-13 c) "w"))
   (modify-syntax-entry (make-char 'latin-iso8859-13 32) "w") ; no-break space
   (modify-syntax-entry (make-char 'latin-iso8859-13 87) "_") ; multiply
   (modify-syntax-entry (make-char 'latin-iso8859-13 119) "_") ; divide
-  (modify-syntax-entry (make-char 'latin-iso8859-13 127) ".") ; right squote
-  )
+  (modify-syntax-entry (make-char 'latin-iso8859-13 127) ".")) ; right squote
 
-(defvar iso8859/13-case-table
-  (let ((table (copy-case-table (standard-case-table))))
-    (mapc (lambda (pair)
-	    (put-case-table-pair (make-char 'latin-iso8859-13 (car pair))
-				 (make-char 'latin-iso8859-13 (cdr pair))
-				 table))
-	  '((#xA8 . #xB8) (#xAA . #xBA) (#xAF . #xBF)))
-    (let ((i #xC0))
-      (while (< i #xDF)
-	(unless (= i #xD7)
-	    (put-case-table-pair (make-char 'latin-iso8859-13 i)
-				 (make-char 'latin-iso8859-13 (+ i #x20))
-				 table))
-	(setq i (1+ i))))	  
-    table)
-  "Case table for Latin 7, right half of ISO 8859/13.")
+(let ((table (standard-case-table)))
+  (mapc (lambda (pair)
+	  (put-case-table-pair (make-char 'latin-iso8859-13 (car pair))
+			       (make-char 'latin-iso8859-13 (cdr pair))
+			       table))
+	'((#xA8 . #xB8) (#xAA . #xBA) (#xAF . #xBF)))
+  (let ((i #xC0))
+    (while (< i #xDF)
+      (unless (= i #xD7)
+	(put-case-table-pair (make-char 'latin-iso8859-13 i)
+			     (make-char 'latin-iso8859-13 (+ i #x20))
+			     table))
+      (setq i (1+ i))))) 
 
-; don't ;;;###autoload
 (unless (find-coding-system 'iso-8859-13)
   ;; Create coding system
   (make-coding-system
    'iso-8859-13 'iso2022 "MIME ISO-8859-13"
-   '(charset-g0 ascii
+   `(charset-g0 ascii
      charset-g1 latin-iso8859-13
      charset-g2 t			; grrr
      charset-g3 t			; grrr
-     mnemonic "MIME/Ltn-7")))
+     mnemonic "MIME/Ltn-7"
+     ,@(if latin-euro-recognize-safe-charsets
+           '(safe-charsets (ascii control-1 latin-iso8859-13))))))
 
-; don't ;;;###autoload
 (unless (assoc "Latin-7" language-info-alist)
   (defun setup-latin7-environment ()
     "Set up multilingual environment (MULE) for Baltic Rim Latin-7 users."
     (interactive)
     (set-language-environment "Latin-7"))
 
-  ;; sheesh, what we do for backward compatibility
-  (apply #'set-language-info-alist
-	 (append `("Latin-7"
-		   ((charset ascii latin-iso8859-13)
-		    (coding-system iso-8859-13)
-		    (coding-priority iso-8859-13)
-		    (input-method . "latin-7-prefix")
-		    (sample-text
-		     .
-		     ,(format "\
+  (set-language-info-alist "Latin-7"
+			   `((charset ascii latin-iso8859-13)
+			     (coding-system iso-8859-13)
+			     (coding-priority iso-8859-13)
+			     (input-method . "latin-7-prefix")
+			     (sample-text . ,(format "\
 Hello, Hej, Tere, Hei, Bonjour, Gr%c%c Gott, Ciao, %cHola!"
-			      ;; SMALL U WITH UMLAUT
-			      (make-char 'latin-iso8859-13 #x7C)
-			      ;; GERMAN SHARP S
-			      (make-char 'latin-iso8859-13 #x5F)
-			      ;; INVERTED EXCLAMATION MARK
-			      (make-char 'latin-iso8859-13 #x21)))
-		    (documentation . "\
+						     ;; SMALL U WITH UMLAUT
+						     (make-char
+						      'latin-iso8859-13 #x7C)
+						     ;; GERMAN SHARP S
+						     (make-char
+						      'latin-iso8859-13 #x5F)
+						     ;; INVERTED EXCLAMATION
+						     ;; MARK
+						     (make-char
+						      'latin-iso8859-13 #x21)))
+			     (documentation . "\
 This is a generic language environment for Latin-7 (ISO-8859-13).  It
-supports the Baltic Rim languages.")))
-		 (if (emacs-version>= 21 1 15)
-		     '(("Baltic Rim"))
-		   nil))))
+supports the Baltic Rim languages."))
+                           '("Baltic Rim")))
 
 (provide 'latin-euro-latin7)
 

File latin-euro-latin8.el

 
 ;;; Code:
 
-;; define ISO-8859-14 for XEmacs 21.4 and earlier
+;;;###autoload
+(defvar latin-euro-recognize-safe-charsets
+  (condition-case nil
+      (progn
+	(coding-system-property (find-coding-system 'iso-8859-1-unix)
+				'safe-charsets)
+	t)
+    (error nil))
+  "t if this XEmacs understands the `safe-charsets' coding-system property.")
+
 ;;;###autoload
 (unless (find-charset 'latin-iso8859-14)
   ;; Create character set
   (make-charset
    'latin-iso8859-14 "ISO8859-14 (Latin 8)"
    ;; sheesh, what we do for backward compatibility
-   ;; #### this test and the similar one below probably should be
-   ;; reformulated to use condition-case
-   (append (if (emacs-version>= 21 4)
-	       '(short-name "Latin-8"
-		 long-name "ISO8859-16 (Latin 8)")
-	     nil)
-	   '(registry "iso8859-14"
-	     dimension 1
-	     columns 1
-	     chars 96
-	     final ?_			; octet 05/15; cf ISO-IR 199
-	     graphic 1
-	     direction l2r)))
-  ;; For syntax of Latin-8 characters.
-  (require 'cl)
-  (load "cl-macs" nil t)
+   '(short-name "Latin-8"
+     long-name "ISO8859-16 (Latin 8)"
+     registry "iso8859-14"
+     dimension 1
+     columns 1
+     chars 96
+     final ?_			; octet 05/15; cf ISO-IR 199
+     graphic 1
+     direction l2r))
   (loop for c from 32 to 127
     do (modify-syntax-entry (make-char 'latin-iso8859-14 c) "w"))
-  (mapc (lambda (c)
-	  (modify-syntax-entry (make-char 'latin-iso8859-14 c) "_"))
-	'(#xA3 #xA7 #xA9 #xAD #xAE #xB6))
-  )
+  (loop for c in '(#xA3 #xA7 #xA9 #xAD #xAE #xB6)
+    do (modify-syntax-entry (make-char 'latin-iso8859-14 c) "_")))
 
 ;;;###autoload
 (unless (find-coding-system 'iso-8859-14)
   ;; Create coding system
   (make-coding-system
    'iso-8859-14 'iso2022 "MIME ISO-8859-14"
-   '(charset-g0 ascii
+   `(charset-g0 ascii
      charset-g1 latin-iso8859-14
      charset-g2 t			; grrr
      charset-g3 t			; grrr
-     mnemonic "MIME/Ltn-8")))
+     mnemonic "MIME/Ltn-8"
+     ,@(if latin-euro-recognize-safe-charsets
+           '(safe-charsets (ascii control-1 latin-iso8859-14))))))
 
 ;;;###autoload
 (unless (assoc "Latin-8" language-info-alist)
     (interactive)
     (set-language-environment "Latin-8"))
 
-  ;; sheesh, what we do for backward compatibility
-  (apply #'set-language-info-alist
-	 (append `("Latin-8"
-		   ((charset ascii latin-iso8859-14)
-		    (coding-system iso-8859-14)
-		    (coding-priority iso-8859-14)
-		    (input-method . "latin-8-prefix")
-		    (sample-text
-		     ,(apply 'format "\
+  (set-language-info-alist
+   "Latin-8"
+   `((charset ascii latin-iso8859-14)
+     (coding-system iso-8859-14)
+     (coding-priority iso-8859-14)
+     (input-method . "latin-8-prefix")
+     (sample-text . ,(apply 'format "\
 Following is the first paragraph of Myles na gCopaleen's An B%cal Bocht, %c
 Eibhl%cn N%c Nuall%cin, 1941, 1999.  The first asterisked word is a rendering
 of \"diversions\" in Irish orthography, and the second \"adventures\":
 nach mbeidh aon saol �d againne nach %cfuil anois ann. \"
 
 * scl%cip
-** eachtra%c" (mapcar '(lambda (code) (make-char 'latin-iso8859-14 code))
-		     '(105 41 109 109 97 97 97 109 97 34 109 34 34 105 97 
-		       109 34 97 105 115 97 97 105 109 109 115 109 109 97 
-		       53 105 105 109 97 97 109 109 97 34 105 109))))
-		    (documentation . "\
+** eachtra%c" (mapcar #'(lambda (code) (make-char 'latin-iso8859-14 code))
+                      '(105 41 109 109 97 97 97 109 97 34 109 34 34 105 97 
+                        109 34 97 105 115 97 97 105 109 109 115 109 109 97 
+                        53 105 105 109 97 97 109 109 97 34 105 109))))
+     (documentation . "\
 This is a generic language environment for Latin-8 (ISO-8859-14).  It
-supports Celtic and most Western European languages.")))
-		 (if (emacs-version>= 21 1 15)
-		     '(("European"))
-		   nil))))
+supports Celtic and most Western European languages."))
+   '("European")))
 
 (provide 'latin-euro-latin8)
 

File latin-euro-latin9.el

 ;;; Code:
 
 ;; define ISO-8859-15 for XEmacs 21.4 and earlier
+
 ;;;###autoload
 (unless (find-charset 'latin-iso8859-15)
   ;; Create character set
   (make-charset
    'latin-iso8859-15 "ISO8859-15 (Latin 9)"
-   ;; sheesh, what we do for backward compatibility
-   ;; #### this test and the similar one below probably should be
-   ;; reformulated to use condition-case
-   (append (if (emacs-version>= 21 4)
-	       '(short-name "Latin-9"
-		 long-name "ISO8859-15 (Latin 9)")
-	     nil)
-	   '(registry "iso8859-15"
-	     dimension 1
-	     columns 1
-	     chars 96
-	     final ?b
-	     graphic 1
-	     direction l2r)))
+   '(short-name "Latin-9"
+     long-name "ISO8859-15 (Latin 9)"
+     registry "iso8859-15"
+     dimension 1
+     columns 1
+     chars 96
+     final ?b
+     graphic 1
+     direction l2r))
   ;; For syntax of Latin-9 characters.
-  (require 'cl)
-  (load "cl-macs" nil t)		; howcum no #'provide?
   (loop for c from 64 to 127		; from '�' to '�'
     do (modify-syntax-entry (make-char 'latin-iso8859-15 c) "w"))
-  (mapc (lambda (c)
-	  (modify-syntax-entry (make-char 'latin-iso8859-15 c) "w"))
-	'(#xA6 #xA8 #xB4 #xB8 #xBC #xBD #xBE))
-  
+  (loop for c in '(#xA6 #xA8 #xB4 #xB8 #xBC #xBD #xBE)
+    do (modify-syntax-entry (make-char 'latin-iso8859-15 c) "w"))
   (modify-syntax-entry (make-char 'latin-iso8859-15 32) "w") ; no-break space
   (modify-syntax-entry (make-char 'latin-iso8859-15 87) "_") ; multiply
-  (modify-syntax-entry (make-char 'latin-iso8859-15 119) "_") ; divide
-  )
+  (modify-syntax-entry (make-char 'latin-iso8859-15 119) "_")) ; divide
 
 ;;;###autoload
 (unless (find-coding-system 'iso-8859-15)
-  ;; Create coding system
+  ;; Create coding system. No need for a `safe-charsets' parameter, if an
+  ;; XEmacs can handle that, it has this coding system built in.
   (make-coding-system
    'iso-8859-15 'iso2022 "MIME ISO-8859-15"
    '(charset-g0 ascii
     (interactive)
     (set-language-environment "Latin-9"))
 
-  ;; sheesh, what we do for backward compatibility
-  (apply #'set-language-info-alist
-	 (append `("Latin-9"
-		   ((charset ascii latin-iso8859-15)
-		    (coding-system iso-8859-15)
-		    (coding-priority iso-8859-15)
-		    (input-method . "latin-9-prefix")
-		    (sample-text
-		     .
-		     ,(format "\
+  (set-language-info-alist
+   "Latin-9"
+   `((charset ascii latin-iso8859-15)
+     (coding-system . iso-8859-15)
+     (coding-priority . iso-8859-15)
+     (input-method . "latin-9-prefix")
+     (sample-text . ,(format "\
 Hello, Hej, Tere, Hei, Bonjour, Gr%c%c Gott, Ciao, %cHola!, my %c0.02"
-			      ;; SMALL U WITH UMLAUT
-			      (make-char 'latin-iso8859-15 #x7C)
-			      ;; GERMAN SHARP S
-			      (make-char 'latin-iso8859-15 #x5F)
-			      ;; INVERTED EXCLAMATION MARK
-			      (make-char 'latin-iso8859-15 #x21)
-			      ;; EURO SIGN
-			      (make-char 'latin-iso8859-15 #x24)))
-		    (documentation . "\
+                             ;; SMALL U WITH UMLAUT
+                             (make-char 'latin-iso8859-15 #x7C)
+                             ;; GERMAN SHARP S
+                             (make-char 'latin-iso8859-15 #x5F)
+                             ;; INVERTED EXCLAMATION MARK
+                             (make-char 'latin-iso8859-15 #x21)
+                             ;; EURO SIGN
+                             (make-char 'latin-iso8859-15 #x24)))
+     (documentation . "\
 This is a generic language environment for Latin-9 (ISO-8859-15).  It
 supports the Euro and the following languages:
  Danish, Dutch, English, Faeroese, Finnish, French, German, Icelandic,
  Irish, Italian, Norwegian, Portuguese, Spanish, and Swedish.
-We also have a German specific language environment \"German\".")))
-		 (if (emacs-version>= 21 1 15)
-		     '(("European"))
-		   nil))))
+We also have a German specific language environment \"German\"."))
+   '("European")))
+
 ;;;###autoload
 (defun-when-void set-character-of-keysym (keysym character)
   "Make CHARACTER be inserted when KEYSYM is pressed,