From e0c8ae101a411f2de94cd03ff8d27c5809e7bdff Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Sat, 1 Mar 2008 15:40:44 +0000 Subject: [PATCH] (make-glyph-code): Don't test the result of `face-id', which already signals an error for invalid faces. (glyph-face): Simplify. --- lisp/ChangeLog | 4 ++++ lisp/disp-table.el | 17 +++++++---------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 4c805de52f5..8f446aead30 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,9 @@ 2008-03-01 Juanma Barranquero + * 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. diff --git a/lisp/disp-table.el b/lisp/disp-table.el index 9124353884b..5e28e2163e7 100644 --- a/lisp/disp-table.el +++ b/lisp/disp-table.el @@ -193,11 +193,9 @@ X frame." (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 @@ X frame." ;;;###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) -- 2.39.5