2008-03-01 Juanma Barranquero <lekktu@gmail.com>
+ * disp-table.el (make-glyph-code): Don't test the result of
+ `face-id', which already signals an error for invalid faces.
+ (glyph-face): Simplify.
+
* desktop.el (desktop-read): Set `desktop-dirname' to nil before
running `desktop-not-loaded-hook' to allow modifying it.
Don't show warning message if `desktop-dirname' was modified.
(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)
;;;###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)