*** empty log message ***
[bpt/emacs.git] / lisp / disp-table.el
index 5433648..5e28e21 100644 (file)
@@ -1,7 +1,7 @@
 ;;; disp-table.el --- functions for dealing with char tables
 
 ;; Copyright (C) 1987, 1994, 1995, 1999, 2001, 2002, 2003, 2004,
-;;   2005, 2006, 2007 Free Software Foundation, Inc.
+;;   2005, 2006, 2007, 2008 Free Software Foundation, Inc.
 
 ;; Author: Erik Naggum <erik@naggum.no>
 ;; Based on a previous version by Howard Gayle
@@ -75,7 +75,7 @@ Valid symbols are `truncation', `wrap', `escape', `control',
 ;;;###autoload
 (defun describe-display-table (dt)
   "Describe the display table DT in a help buffer."
-  (with-output-to-temp-buffer "*Help*"
+  (with-help-window "*Help*"
     (princ "\nTruncation glyph: ")
     (prin1 (display-table-slot dt 'truncation))
     (princ "\nWrap glyph: ")
@@ -97,8 +97,7 @@ Valid symbols are `truncation', `wrap', `escape', `control',
          (aset vector i (aref dt i))
          (setq i (1+ i)))
        (describe-vector vector))
-      (help-mode))
-    (print-help-return-message)))
+      (help-mode))))
 
 ;;;###autoload
 (defun describe-current-display-table ()
@@ -191,24 +190,29 @@ X frame."
   "Return a glyph code representing char CHAR with face FACE."
   ;; Due to limitations on Emacs integer values, faces with
   ;; face id greater that 512 are silently ignored.
-  (if (and face (<= (face-id face) #x1ff))
-      (logior char (lsh (face-id face) 22))
-    char))
+  (if (not face)
+      char
+    (let ((fid (face-id face)))
+      (if (< fid 64) ; we have 32 - 3(LSB) - 1(SIGN) - 22(CHAR) = 6 bits for face id
+         (logior char (lsh fid 22))
+       (cons char fid)))))
 
 ;;;###autoload
 (defun glyph-char (glyph)
   "Return the character of glyph code GLYPH."
-  (logand glyph #x3fffff))
+  (if (consp glyph)
+      (car glyph)
+    (logand glyph #x3fffff)))
 
 ;;;###autoload
 (defun glyph-face (glyph)
   "Return the face of glyph code GLYPH, or nil if glyph has default face."
-  (let ((face-id (lsh glyph -22)))
+  (let ((face-id (if (consp glyph) (cdr glyph) (lsh glyph -22))))
     (and (> face-id 0)
-        (car (delq nil (mapcar (lambda (face)
-                                 (and (eq (get face 'face) face-id)
-                                      face))
-                               (face-list)))))))
+        (catch 'face
+          (dolist (face (face-list))
+            (when (eq (face-id face) face-id)
+              (throw 'face face)))))))
 
 ;;;###autoload
 (defun standard-display-european (arg)