Merge from emacs--rel--22
[bpt/emacs.git] / lisp / international / latin1-disp.el
index e558c22..26e1a69 100644 (file)
@@ -1,6 +1,7 @@
 ;;; latin1-disp.el --- display tables for other ISO 8859 on Latin-1 terminals -*-coding: iso-2022-7bit;-*-
 
-;; Copyright (C) 2000, 2001, 2003  Free Software Foundation, Inc.
+;; Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+;;   Free Software Foundation, Inc.
 
 ;; Author: Dave Love <fx@gnu.org>
 ;; Keywords: i18n
@@ -9,7 +10,7 @@
 
 ;; GNU Emacs is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
+;; the Free Software Foundation; either version 3, or (at your option)
 ;; any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
@@ -100,24 +101,12 @@ 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)
          ;; Extra stuff for windows-1252, in particular.
          (mapc
           (lambda (l)
@@ -137,12 +126,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)))
 
@@ -176,14 +161,10 @@ asis."
       (if (eq 'default latin1-display-face)
          (standard-display-ascii char (format latin1-display-format display))
        (aset standard-display-table char
-             (vconcat (mapcar (lambda (c)
-                                (logior c (lsh (face-id latin1-display-face)
-                                               19)))
+             (vconcat (mapcar (lambda (c) (make-glyph-code c latin1-display-face))
                               display))))
     (aset standard-display-table char
-         (if (eq 'default latin1-display-face)
-             display
-           (logior display (lsh (face-id latin1-display-face) 19))))))
+         (make-glyph-code display latin1-display-face))))
 
 (defun latin1-display-identities (charset)
   "Display each character in CHARSET as the corresponding Latin-1 character.
@@ -194,9 +175,10 @@ using an ISO8859 character set."
   (let ((i 32)
        (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)))
+      (let ((ch (decode-char set (+ i 128))))
+       (if ch
+           (aset standard-display-table ch
+                 (vector (make-char 'latin-iso8859-1 i)))))
       (setq i (1+ i)))))
 
 (defun latin1-display-reset (language)
@@ -780,9 +762,9 @@ 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