diff lisp/disp-table.el @ 92370:ec29b9d50b84

(make-glyph-code): Don't test the result of `face-id', which already signals an error for invalid faces. (glyph-face): Simplify.
author Juanma Barranquero <lekktu@gmail.com>
date Sat, 01 Mar 2008 15:39:13 +0000
parents 7898dbba29fe
children ee5932bf781d
line wrap: on
line diff
--- a/lisp/disp-table.el	Sat Mar 01 14:59:17 2008 +0000
+++ b/lisp/disp-table.el	Sat Mar 01 15:39:13 2008 +0000
@@ -193,11 +193,9 @@
   (if (not face)
       char
     (let ((fid (face-id face)))
-      (cond
-       ((not fid) (error "unknown face"))
-       ((< fid 64) ; we have 32 - 3(LSB) - 1(SIGN) - 22(CHAR) = 6 bits for face id
-	(logior char (lsh fid 22)))
-       (t (cons char fid))))))
+      (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)
@@ -209,13 +207,12 @@
 ;;;###autoload
 (defun glyph-face (glyph)
   "Return the face of glyph code GLYPH, or nil if glyph has default face."
-
   (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)