]> code.delx.au - gnu-emacs/blobdiff - lisp/international/latin1-disp.el
(latin1-display): Don't use
[gnu-emacs] / lisp / international / latin1-disp.el
index 515695bf5038b195b73000e38d48ccc89d3eaba4..a2119ad62c31feaa0b8b3b719831be8245bdce86 100644 (file)
@@ -1,6 +1,6 @@
 ;;; latin1-disp.el --- display tables for other ISO 8859 on Latin-1 terminals -*-coding: iso-2022-7bit;-*-
 
-;; Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
+;; Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
 ;;   Free Software Foundation, Inc.
 
 ;; Author: Dave Love <fx@gnu.org>
@@ -101,24 +101,11 @@ use either \\[customize] or the function `latin1-display'."
 See option `latin1-display' for the method.  The members of the list
 must be in `latin1-display-sets'.  With no arguments, reset the
 display for all of `latin1-display-sets'. See also
-`latin1-display-setup'.  As well as iso-8859 characters, this treats
-some characters in the `mule-unicode-...' charsets if you don't have
-a Unicode font with which to display them."
+`latin1-display-setup'."
   (if sets
       (progn
        (mapc #'latin1-display-setup sets)
-       (unless (char-displayable-p
-                (make-char 'mule-unicode-0100-24ff 32 33))
-         ;; It doesn't look as though we have a Unicode font.
-         (map-char-table
-          (lambda (c uc)
-            (when (and (char-valid-p c)
-                       (char-valid-p uc)
-                       (not (aref standard-display-table uc)))
-              (aset standard-display-table uc
-                    (or (aref standard-display-table c)
-                        (vector c)))))
-          ucs-mule-8859-to-mule-unicode)
+       (unless (char-displayable-p #x101) ; a with macron
          ;; Extra stuff for windows-1252, in particular.
          (mapc
           (lambda (l)
@@ -138,12 +125,8 @@ a Unicode font with which to display them."
             )))
          (setq latin1-display t))
     (mapc #'latin1-display-reset latin1-display-sets)
-    (aset standard-display-table
-         (make-char 'mule-unicode-0100-24ff) nil)
-    (aset standard-display-table
-         (make-char 'mule-unicode-2500-33ff) nil)
-    (aset standard-display-table
-         (make-char 'mule-unicode-e000-ffff) nil)
+    (set-char-table-range standard-display-table '(#x0100 . #x33FF) nil)
+    (set-char-table-range standard-display-table '(#xE000 . #xFFFF) nil)
     (setq latin1-display nil)
     (redraw-display)))
 
@@ -188,12 +171,12 @@ CHARSET is a symbol which is the nickname of a language environment
 using an ISO8859 character set."
   (if (eq charset 'cyrillic)
       (setq charset 'cyrillic-iso))
-  (let ((i 32)
+  (let ((i 128)
        (set (car (remq 'ascii (get-language-info charset 'charset)))))
-    (while (<= i 127)
-      (aset standard-display-table
-           (make-char set i)
-           (vector (make-char 'latin-iso8859-1 i)))
+    (while (<= i 255)
+      (let ((ch (decode-char set i)))
+       (if ch
+           (aset standard-display-table ch (vector i))))
       (setq i (1+ i)))))
 
 (defun latin1-display-reset (language)
@@ -206,8 +189,9 @@ character set."
                     'arabic-iso8859-6
                   (car (remq 'ascii (get-language-info language
                                                        'charset))))))
-    (standard-display-default (make-char charset 32)
-                             (make-char charset 127)))
+    (map-charset-chars #'(lambda (range arg)
+                          (standard-display-default (car range) (cdr range)))
+                      charset))
   (sit-for 0))
 
 (defun latin1-display-check-font (language)
@@ -217,7 +201,7 @@ character set: `latin-2', `hebrew' etc."
   (if (eq language 'cyrillic)
       (setq language 'cyrillic-iso))
   (let* ((info (get-language-info language 'charset))
-        (char (and info (make-char (car (remq 'ascii info)) ?\ ))))
+        (char (and info (decode-char (car (remq 'ascii info)) ?\ ))))
     (and char (char-displayable-p char))))
 
 ;; Backwards compatibility.
@@ -547,9 +531,10 @@ is.  If FORCE is non-nil, set up the display regardless."
     ;; missing some glyphs.)
     (let ((i 34))
       (while (<= i 62)
-       (aset standard-display-table
-             (make-char 'hebrew-iso8859-8 i)
-             (vector (make-char 'latin-iso8859-1 i)))
+       (let ((ch (decode-char 'hebrew-iso8859-8 i)))
+         (if ch
+             (aset standard-display-table ch
+                   (vector (decode-char 'latin-iso8859-1 i)))))
        (setq i (1+ i))))
     (mapc
      (lambda (l)
@@ -777,13 +762,12 @@ use either \\[customize] or the function `latin1-display'."
   "Set up Latin-1/ASCII display for Unicode characters.
 This uses the transliterations of the Lynx browser.
 
-With argument ARG, turn such display on iff ARG is positive, otherwise
+With argument ARG, turn such display on if ARG is positive, otherwise
 turn it off and display Unicode characters literally.  The display
-is't changed if the display can render Unicode characters."
+isn't changed if the display can render Unicode characters."
   (interactive "p")
   (if (> arg 0)
-      (unless (char-displayable-p
-              (make-char 'mule-unicode-0100-24ff 32 33))
+      (unless (char-displayable-p #x101) ; a with macron
        ;; It doesn't look as though we have a Unicode font.
        (let ((latin1-display-format "%s"))
          (mapc