From 2272e9676939435f7acc469b5b75defe635919c0 Mon Sep 17 00:00:00 2001 From: "Kim F. Storm" Date: Mon, 22 Nov 2004 23:25:49 +0000 Subject: [PATCH] (lookup_named_face): Add signal_p arg. Return -1 if signal_p is zero and face name is unknown. (Fx_list_fonts): Don't signal error in lookup_named_face. (Fface_font): Signal error in lookup_named_face. (ascii_face_of_lisp_face): Likewise. --- src/xfaces.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/xfaces.c b/src/xfaces.c index 1e0de77ea3b..590e9885622 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -3009,7 +3009,7 @@ the WIDTH times as wide as FACE on FRAME. */) { /* This is of limited utility since it works with character widths. Keep it for compatibility. --gerd. */ - int face_id = lookup_named_face (f, face, 0); + int face_id = lookup_named_face (f, face, 0, 0); struct face *face = (face_id < 0 ? NULL : FACE_FROM_ID (f, face_id)); @@ -4923,7 +4923,7 @@ If FRAME is omitted or nil, use the selected frame. */) else { struct frame *f = frame_or_selected_frame (frame, 1); - int face_id = lookup_named_face (f, face, 0); + int face_id = lookup_named_face (f, face, 0, 1); struct face *face = FACE_FROM_ID (f, face_id); return face ? build_string (face->font_name) : Qnil; } @@ -5615,10 +5615,11 @@ lookup_face (f, attr, c, base_face) isn't realized and cannot be realized. */ int -lookup_named_face (f, symbol, c) +lookup_named_face (f, symbol, c, signal_p) struct frame *f; Lisp_Object symbol; int c; + int signal_p; { Lisp_Object attrs[LFACE_VECTOR_SIZE]; Lisp_Object symbol_attrs[LFACE_VECTOR_SIZE]; @@ -5631,7 +5632,9 @@ lookup_named_face (f, symbol, c) default_face = FACE_FROM_ID (f, DEFAULT_FACE_ID); } - get_lface_attributes (f, symbol, symbol_attrs, 1); + if (!get_lface_attributes (f, symbol, symbol_attrs, signal_p)) + return -1; + bcopy (default_face->lface, attrs, sizeof attrs); merge_face_vectors (f, symbol_attrs, attrs, 0); @@ -5652,7 +5655,7 @@ ascii_face_of_lisp_face (f, lface_id) if (lface_id >= 0 && lface_id < lface_id_to_name_size) { Lisp_Object face_name = lface_id_to_name[lface_id]; - face_id = lookup_named_face (f, face_name, 0); + face_id = lookup_named_face (f, face_name, 0, 1); } else face_id = -1; -- 2.39.2