From 770e2e6ed85e3c3fdf1f770ccbcb7f3120370c05 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Fri, 20 Jun 2008 01:53:32 +0000 Subject: [PATCH] * w32fns.c, xfnc.c (x_default_font_parameter): Only set `font-param' for explicit `font' parameters. * frame.c (x_set_font): Remove unexplained call to fix inf-recursion. --- src/ChangeLog | 7 +++++++ src/frame.c | 8 +++++++- src/w32fns.c | 15 ++++++++++----- src/xfns.c | 13 +++++++++---- 4 files changed, 33 insertions(+), 10 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index bd8d02017ae..43f9f1f2154 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2008-06-20 Stefan Monnier + + * w32fns.c, xfnc.c (x_default_font_parameter): Only set `font-param' + for explicit `font' parameters. + + * frame.c (x_set_font): Remove unexplained call to fix inf-recursion. + 2008-06-19 Kenichi Handa * frame.c: Include . diff --git a/src/frame.c b/src/frame.c index 761e6cc9a77..6320d0ca1ff 100644 --- a/src/frame.c +++ b/src/frame.c @@ -3400,7 +3400,13 @@ x_set_font (f, arg, oldval) if (FRAME_FACE_CACHE (f)) { XSETFRAME (frame, f); - call1 (Qface_set_after_frame_default, frame); + /* We used to call face-set-after-frame-default here, but it leads to + recursive calls (since that function can set the `default' face's + font which in turns changes the frame's `font' parameter). + Also I don't know what this call is meant to do, but it seems the + wrong way to do it anyway (it does a lot more work than what seems + reasonable in response to a change to `font'). */ + /* call1 (Qface_set_after_frame_default, frame); */ } } diff --git a/src/w32fns.c b/src/w32fns.c index 34897314567..9a7e49cf0db 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -4274,8 +4274,13 @@ x_default_font_parameter (f, parms) Lisp_Object parms; { struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f); - Lisp_Object font = x_get_arg (dpyinfo, parms, Qfont, "font", "Font", - RES_TYPE_STRING); + Lisp_Object font_param = x_get_arg (dpyinfo, parms, Qfont, NULL, NULL, + RES_TYPE_STRING); + Lisp_Object font; + if (EQ (font_param, Qunbound)) + font_param = Qnil; + font = !NILP (font_param) ? font_param + : x_get_arg (dpyinfo, parms, Qfont, "font", "Font", RES_TYPE_STRING); if (!STRINGP (font)) { @@ -4296,12 +4301,12 @@ x_default_font_parameter (f, parms) if (NILP (font)) error ("No suitable font was found"); } - else + else if (!NILP (font_param)) { /* Remember the explicit font parameter, so we can re-apply it after we've applied the `default' face settings. */ - x_set_frame_parameters (f, Fcons (Fcons (Qfont_param, font), Qnil)); - } + x_set_frame_parameters (f, Fcons (Fcons (Qfont_param, font_param), Qnil)); + } x_default_parameter (f, parms, Qfont, font, "font", "Font", RES_TYPE_STRING); } diff --git a/src/xfns.c b/src/xfns.c index 58b03691e2f..0d31f015b82 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -3060,8 +3060,13 @@ x_default_font_parameter (f, parms) Lisp_Object parms; { struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); - Lisp_Object font = x_get_arg (dpyinfo, parms, Qfont, "font", "Font", + Lisp_Object font_param = x_get_arg (dpyinfo, parms, Qfont, NULL, NULL, RES_TYPE_STRING); + Lisp_Object font; + if (EQ (font_param, Qunbound)) + font_param = Qnil; + font = !NILP (font_param) ? font_param + : x_get_arg (dpyinfo, parms, Qfont, "font", "Font", RES_TYPE_STRING); if (! STRINGP (font)) { @@ -3088,12 +3093,12 @@ x_default_font_parameter (f, parms) if (NILP (font)) error ("No suitable font was found"); } - else + else if (!NILP (font_param)) { /* Remember the explicit font parameter, so we can re-apply it after we've applied the `default' face settings. */ - x_set_frame_parameters (f, Fcons (Fcons (Qfont_param, font), Qnil)); - } + x_set_frame_parameters (f, Fcons (Fcons (Qfont_param, font_param), Qnil)); + } x_default_parameter (f, parms, Qfont, font, "font", "Font", RES_TYPE_STRING); } -- 2.39.2