Fix copyrights.
[bpt/emacs.git] / lisp / international / latin1-disp.el
index fae82cd..12b0c22 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 Free Software Foundation, Inc.
+;; Copyright (C) 2000, 2001, 2003  Free Software Foundation, Inc.
 
 ;; Author: Dave Love <fx@gnu.org>
 ;; Keywords: i18n
@@ -84,7 +84,7 @@ This option also treats some characters in the `mule-unicode-...'
 charsets if you don't have a Unicode font with which to display them.
 
 Setting this variable directly does not take effect;
-use either M-x customize of the function `latin1-display'."
+use either \\[customize] or the function `latin1-display'."
   :group 'latin1-display
   :type 'boolean
   :require 'latin1-disp
@@ -156,7 +156,7 @@ input sequences."
 (defcustom latin1-display-face 'default
   "Face to use for displaying substituted ASCII sequences."
   :type 'face
-  :version "21.4"
+  :version "22.1"
   :group 'latin1-display)
 
 (defun latin1-display-char (char display &optional alt-display)
@@ -225,7 +225,7 @@ character set: `latin-2', `hebrew' etc."
 
 ;; Backwards compatibility.
 (defalias 'latin1-char-displayable-p 'char-displayable-p)
-(make-obsolete 'latin1-char-displayable-p 'char-displayable-p "21.5")
+(make-obsolete 'latin1-char-displayable-p 'char-displayable-p "22.1")
 
 (defun latin1-display-setup (set &optional force)
   "Set up Latin-1 display for characters in the given SET.
@@ -234,12 +234,11 @@ whether a font for SET is available and don't set the display if it
 is.  If FORCE is non-nil, set up the display regardless."
   (cond
    ((eq set 'latin-2)
-    (when (or force
-             (not (latin1-display-check-font set)))
-      (latin1-display-identities set)
-      (mapc
-       (lambda (l)
-        (apply 'latin1-display-char l))
+    (latin1-display-identities set)
+    (mapc
+     (lambda (l)
+       (or (char-displayable-p (car l))
+          (apply 'latin1-display-char l)))
        '((?\e,BF\e(B "'C" "C'")
         (?\e,BP\e(B "'D" "/D")
         (?\e,B&\e(B "'S" "S'")
@@ -300,15 +299,14 @@ is.  If FORCE is non-nil, set up the display regardless."
         (?\e,Bk\e(B "\"e")
         (?\e,B=\e(B "''" "'")
         (?\e,B7\e(B "'<")                        ; Lynx's rendering of caron
-        ))))
+        )))
 
    ((eq set 'latin-3)
-    (when (or force
-             (not (latin1-display-check-font set)))
-      (latin1-display-identities set)
-      (mapc
-       (lambda (l)
-        (apply 'latin1-display-char l))
+    (latin1-display-identities set)
+    (mapc
+     (lambda (l)
+       (or (char-displayable-p (car l))
+          (apply 'latin1-display-char l)))
        '((?\e,C!\e(B "/H")
         (?\e,C"\e(B "~`" "'(")
         (?\e,C&\e(B "^H" "H^")
@@ -336,15 +334,14 @@ is.  If FORCE is non-nil, set up the display regardless."
         (?\e,Cx\e(B "^g" "g^")
         (?\e,C}\e(B "~u" "u(")
         (?\e,C~\e(B "^s" "s^")
-        (?\e,C\7f\e(B "/." "^.")))))
+        (?\e,C\7f\e(B "/." "^."))))
 
    ((eq set 'latin-4)
-    (when (or force
-             (not (latin1-display-check-font set)))
-      (latin1-display-identities set)
-      (mapc
-       (lambda (l)
-        (apply 'latin1-display-char l))
+    (latin1-display-identities set)
+    (mapc
+     (lambda (l)
+       (or (char-displayable-p (car l))
+          (apply 'latin1-display-char l)))
        '((?\e,D!\e(B "A," "A;")
         (?\e,D"\e(B "k/" "kk")
         (?\e,D#\e(B "R," ",R")
@@ -393,15 +390,14 @@ is.  If FORCE is non-nil, set up the display regardless."
         (?\e,Dy\e(B "u," "u;")
         (?\e,D}\e(B "u~" "~u")
         (?\e,D~\e(B "u-")
-        (?\e,D\7f\e(B "^.")))))
+        (?\e,D\7f\e(B "^."))))
 
    ((eq set 'latin-5)
-    (when (or force
-             (not (latin1-display-check-font set)))
-      (latin1-display-identities set)
-      (mapc
-       (lambda (l)
-        (apply 'latin1-display-char l))
+    (latin1-display-identities set)
+    (mapc
+     (lambda (l)
+       (or (char-displayable-p (car l))
+        (apply 'latin1-display-char l)))
        '((?\e,Mp\e(B "~g" "g(")
         (?\e,MP\e(B "~G" "G(")
         (?\e,M]\e(B ".I" "I^.")
@@ -410,15 +406,14 @@ is.  If FORCE is non-nil, set up the display regardless."
         (?\e,Mj\e(B "^e" "e<")                   ; from latin-post
         (?\e,Ml\e(B ".e" "e^.")
         (?\e,Mo\e(B "\"i" "i-")          ; from latin-post
-        (?\e,M}\e(B ".i" "i.")))))
+        (?\e,M}\e(B ".i" "i."))))
 
    ((eq set 'latin-8)
-    (when (or force
-             (not (latin1-display-check-font set)))
-      (latin1-display-identities set)
-      (mapc
-       (lambda (l)
-        (apply 'latin1-display-char l))
+    (latin1-display-identities set)
+    (mapc
+     (lambda (l)
+       (or (char-displayable-p (car l))
+          (apply 'latin1-display-char l)))
        '((?\e,_!\e(B ".B" "B`")
         (?\e,_"\e(B ".b" "b`")
         (?\e,_%\e(B ".c" "c`")
@@ -449,15 +444,14 @@ is.  If FORCE is non-nil, set up the display regardless."
         (?\e,_W\e(B ".T" "T`")
         (?\e,_~\e(B "^y" "y^")
         (?\e,_^\e(B "^Y" "Y^")
-        (?\e,_/\e(B "\"Y")))))
+        (?\e,_/\e(B "\"Y"))))
 
    ((eq set 'latin-9)
-    (when (or force
-             (not (latin1-display-check-font set)))
-      (latin1-display-identities set)
-      (mapc
-       (lambda (l)
-        (apply 'latin1-display-char l))
+    (latin1-display-identities set)
+    (mapc
+     (lambda (l)
+       (or (char-displayable-p (car l))
+          (apply 'latin1-display-char l)))
        '((?\e,b(\e(B "~s" "s<")
         (?\e,b&\e(B "~S" "S<")
         (?\e,b$\e(B "Euro" "E=")
@@ -465,14 +459,13 @@ is.  If FORCE is non-nil, set up the display regardless."
         (?\e,b4\e(B "~Z" "Z<")
         (?\e,b>\e(B "\"Y")
         (?\e,b=\e(B "oe")
-        (?\e,b<\e(B "OE")))))
+        (?\e,b<\e(B "OE"))))
 
    ((eq set 'greek)
-    (when (or force
-             (not (latin1-display-check-font set)))
-      (mapc
-       (lambda (l)
-        (apply 'latin1-display-char l))
+    (mapc
+     (lambda (l)
+       (or (char-displayable-p (car l))
+          (apply 'latin1-display-char l)))
        '((?\e,F!\e(B "9'")
         (?\e,F"\e(B "'9")
         (?\e,F/\e(B "-M")
@@ -531,9 +524,10 @@ is.  If FORCE is non-nil, set up the display regardless."
         (?\e,F|\e(B "'o")
         (?\e,F}\e(B "'u")
         (?\e,F~\e(B "'w")))
-      (mapc
-       (lambda (l)
-        (aset standard-display-table (car l) (string-to-vector (cadr l))))
+    (mapc
+     (lambda (l)
+       (or (char-displayable-p (car l))
+          (aset standard-display-table (car l) (string-to-vector (cadr l)))))
        '((?\e,FA\e(B "A")
         (?\e,FB\e(B "B")
         (?\e,FE\e(B "E")
@@ -548,23 +542,22 @@ is.  If FORCE is non-nil, set up the display regardless."
         (?\e,FT\e(B "T")
         (?\e,FU\e(B "Y")
         (?\e,FW\e(B "X")
-        (?\e,Fo\e(B "o")))))
+        (?\e,Fo\e(B "o"))))
 
    ((eq set 'hebrew)
-    (when (or force
-             (not (latin1-display-check-font set)))
-      ;; Don't start with identities, since we don't have definitions
-      ;; for a lot of Hebrew in internal.el.  (Intlfonts is also
-      ;; 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)))
-         (setq i (1+ i))))
-      (mapc
-       (lambda (l)
-        (aset standard-display-table (car l) (string-to-vector (cadr l))))
+    ;; Don't start with identities, since we don't have definitions
+    ;; for a lot of Hebrew in internal.el.  (Intlfonts is also
+    ;; 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)))
+       (setq i (1+ i))))
+    (mapc
+     (lambda (l)
+       (or (char-displayable-p (car l))
+          (aset standard-display-table (car l) (string-to-vector (cadr l)))))
        '((?\e,H_\e(B "=2")
         (?\e,H`\e(B "A+")
         (?\e,Ha\e(B "B+")
@@ -592,19 +585,21 @@ is.  If FORCE is non-nil, set up the display regardless."
         (?\e,Hw\e(B "Q+")
         (?\e,Hx\e(B "R+")
         (?\e,Hy\e(B "Sh")
-        (?\e,Hz\e(B "T+")))))
+        (?\e,Hz\e(B "T+"))))
 
    ;; Arabic probably isn't so useful in the absence of Arabic
    ;; language support...
    ((eq set 'arabic)
     (setq set 'arabic)
-    (when (or force
-             (not (latin1-display-check-font set)))
-      (aset standard-display-table ?\e,G \e(B "\e,A \e(B")
-      (aset standard-display-table ?\e,G$\e(B "\e,A$\e(B")
-      (aset standard-display-table ?\e,G-\e(B "\e,A-\e(B")
-      (mapc (lambda (l)
-             (apply  'latin1-display-char l))
+    (or (char-displayable-p ?\e,G \e(B)
+       (aset standard-display-table ?\e,G \e(B "\e,A \e(B"))
+    (or (char-displayable-p ?\e,G$\e(B)
+       (aset standard-display-table ?\e,G$\e(B "\e,A$\e(B"))
+    (or (char-displayable-p ?\e,G-\e(B)
+       (aset standard-display-table ?\e,G-\e(B "\e,A-\e(B"))
+    (mapc (lambda (l)
+           (or (char-displayable-p (car l))
+               (apply  'latin1-display-char l)))
            '((?\e,G,\e(B ",+")
              (?\e,G;\e(B ";+")
              (?\e,G?\e(B "?+")
@@ -652,15 +647,14 @@ is.  If FORCE is non-nil, set up the display regardless."
              (?\e,Go\e(B "'+")
              (?\e,Gp\e(B "1+")
              (?\e,Gq\e(B "3+")
-             (?\e,Gr\e(B "0+")))))
+             (?\e,Gr\e(B "0+"))))
 
    ((eq set 'cyrillic)
     (setq set 'cyrillic-iso)
-    (when (or force
-             (not (latin1-display-check-font set)))
-      (mapc
-       (lambda (l)
-        (apply 'latin1-display-char l))
+    (mapc
+     (lambda (l)
+       (or (char-displayable-p (car l))
+          (apply 'latin1-display-char l)))
        '((?\e,L"\e(B "Dj")
         (?\e,L#\e(B "Gj")
         (?\e,L$\e(B "IE")
@@ -727,9 +721,10 @@ is.  If FORCE is non-nil, set up the display regardless."
         (?\e,L|\e(B "kj")
         (?\e,L~\e(B "v%")
         (?\e,L\7f\e(B "dzh")))
-      (mapc
-       (lambda (l)
-        (aset standard-display-table (car l) (string-to-vector (cadr l))))
+    (mapc
+     (lambda (l)
+       (or (char-displayable-p (car l))
+          (aset standard-display-table (car l) (string-to-vector (cadr l)))))
        '((?\e,L!\e(B "\e,AK\e(B")
         (?\e,L%\e(B "S")
         (?\e,L&\e(B "I")
@@ -758,7 +753,7 @@ is.  If FORCE is non-nil, set up the display regardless."
         (?\e,Lu\e(B "s")
         (?\e,Lv\e(B "i")
         (?\e,Lw\e(B "\e,Ao\e(B")
-        (?\e,Lx\e(B "j")))))
+        (?\e,Lx\e(B "j"))))
 
    (t (error "Unsupported character set: %S" set)))
 
@@ -767,11 +762,11 @@ is.  If FORCE is non-nil, set up the display regardless."
 ;;;###autoload
 (defcustom latin1-display-ucs-per-lynx nil
   "Set up Latin-1/ASCII display for Unicode characters.
-This uses the transliterations of the Lynx browser.  The display is't
+This uses the transliterations of the Lynx browser.  The display isn't
 changed if the display can render Unicode characters.
 
 Setting this variable directly does not take effect;
-use either M-x customize of the function `latin1-display'."
+use either \\[customize] or the function `latin1-display'."
   :group 'latin1-display
   :type 'boolean
   :require 'latin1-disp