diff options
| author | Richard M. Stallman | 1995-01-28 08:27:31 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1995-01-28 08:27:31 +0000 |
| commit | 962a60aa70c98e5e2262786babf64ed558348408 (patch) | |
| tree | b6c3a949544bd2a100f732127bff76642d188efc | |
| parent | 3ac613c1405d04575318bb0f9d834c025c0d1419 (diff) | |
| download | emacs-962a60aa70c98e5e2262786babf64ed558348408.tar.gz emacs-962a60aa70c98e5e2262786babf64ed558348408.zip | |
(facep): New function.
(internal-check-face): Don't make a loop, since signal can't return.
| -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 @@ | |||
| 49 | (defsubst internal-facep (x) | 49 | (defsubst internal-facep (x) |
| 50 | (and (vectorp x) (= (length x) 8) (eq (aref x 0) 'face))) | 50 | (and (vectorp x) (= (length x) 8) (eq (aref x 0) 'face))) |
| 51 | 51 | ||
| 52 | (defun facep (x) | ||
| 53 | "Return t if X is a face name or an internal face vector." | ||
| 54 | (and (or (internal-facep x) | ||
| 55 | (and (symbolp x) (assq x global-face-data))) | ||
| 56 | t)) | ||
| 57 | |||
| 52 | (defmacro internal-check-face (face) | 58 | (defmacro internal-check-face (face) |
| 53 | (` (while (not (internal-facep (, face))) | 59 | (` (or (internal-facep (, face)) |
| 54 | (setq (, face) (signal 'wrong-type-argument (list 'internal-facep (, face))))))) | 60 | (signal 'wrong-type-argument (list 'internal-facep (, face)))))) |
| 55 | 61 | ||
| 56 | ;;; Accessors. | 62 | ;;; Accessors. |
| 57 | (defun face-name (face) | 63 | (defun face-name (face) |
| @@ -547,10 +553,15 @@ also the same size as FACE on FRAME, or fail." | |||
| 547 | (let ((fonts (x-list-fonts pattern face frame))) | 553 | (let ((fonts (x-list-fonts pattern face frame))) |
| 548 | (or fonts | 554 | (or fonts |
| 549 | (if face | 555 | (if face |
| 550 | (error "No fonts matching pattern are the same size as `%s'" | 556 | (if (string-match "\\*" pattern) |
| 551 | (if (null (face-font face)) | 557 | (if (null (face-font face)) |
| 552 | (cdr (assq 'font (frame-parameters frame))) | 558 | (error "No matching fonts are the same height as the frame default font") |
| 553 | face)) | 559 | (error "No matching fonts are the same height as face `%s'" face)) |
| 560 | (if (null (face-font face)) | ||
| 561 | (error "Height of font `%s' doesn't match the frame default font" | ||
| 562 | pattern) | ||
| 563 | (error "Height of font `%s' doesn't match face `%s'" | ||
| 564 | pattern face))) | ||
| 554 | (error "No fonts match `%s'" pattern))) | 565 | (error "No fonts match `%s'" pattern))) |
| 555 | (car fonts)) | 566 | (car fonts)) |
| 556 | (cdr (assq 'font (frame-parameters (selected-frame)))))) | 567 | (cdr (assq 'font (frame-parameters (selected-frame)))))) |