diff options
author | Richard M. Stallman <rms@gnu.org> | 1995-01-28 08:27:31 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 1995-01-28 08:27:31 +0000 |
commit | 3ed817ac522a9b69545cbf23050ba8896ce81bbe (patch) | |
tree | 701d555a907b9feb4adc80ef6588194d6972d085 /lisp/faces.el | |
parent | 168a3c748cbef5d8e943118ae2bb54e44151d1da (diff) | |
download | emacs-3ed817ac522a9b69545cbf23050ba8896ce81bbe.tar.gz |
(facep): New function.
(internal-check-face): Don't make a loop, since signal can't return.
Diffstat (limited to 'lisp/faces.el')
-rw-r--r-- | lisp/faces.el | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/lisp/faces.el b/lisp/faces.el index 8c928962e73..6ee8465b714 100644 --- a/lisp/faces.el +++ b/lisp/faces.el @@ -49,9 +49,15 @@ (defsubst internal-facep (x) (and (vectorp x) (= (length x) 8) (eq (aref x 0) 'face))) +(defun facep (x) + "Return t if X is a face name or an internal face vector." + (and (or (internal-facep x) + (and (symbolp x) (assq x global-face-data))) + t)) + (defmacro internal-check-face (face) - (` (while (not (internal-facep (, face))) - (setq (, face) (signal 'wrong-type-argument (list 'internal-facep (, face))))))) + (` (or (internal-facep (, face)) + (signal 'wrong-type-argument (list 'internal-facep (, face)))))) ;;; Accessors. (defun face-name (face) @@ -547,10 +553,15 @@ also the same size as FACE on FRAME, or fail." (let ((fonts (x-list-fonts pattern face frame))) (or fonts (if face - (error "No fonts matching pattern are the same size as `%s'" - (if (null (face-font face)) - (cdr (assq 'font (frame-parameters frame))) - face)) + (if (string-match "\\*" pattern) + (if (null (face-font face)) + (error "No matching fonts are the same height as the frame default font") + (error "No matching fonts are the same height as face `%s'" face)) + (if (null (face-font face)) + (error "Height of font `%s' doesn't match the frame default font" + pattern) + (error "Height of font `%s' doesn't match face `%s'" + pattern face))) (error "No fonts match `%s'" pattern))) (car fonts)) (cdr (assq 'font (frame-parameters (selected-frame)))))) |