From: Gerd Moellmann Date: Fri, 14 Jul 2000 13:56:56 +0000 (+0000) Subject: (eval_form): GCPRO argument sexpr. X-Git-Tag: emacs-pretest-21.0.90~2830 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=0d8b31c0ff1b0814b8b38206961d5c6a83a3ac69;p=emacs.git (eval_form): GCPRO argument sexpr. (call_function): New function. (handle_single_display_prop): Use call_function and FUNCTIONP instead of checking whether if font_height is a symbol and using eval_form. --- diff --git a/src/xdisp.c b/src/xdisp.c index 4afe2fd40ca..1f211b4d002 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -1049,7 +1049,7 @@ compute_string_pos (newpos, pos, string) Lisp form evaluation ***********************************************************************/ -/* Error handler for eval_form. */ +/* Error handler for eval_form and call_function. */ static Lisp_Object eval_handler (arg) @@ -1067,9 +1067,35 @@ eval_form (sexpr) Lisp_Object sexpr; { int count = specpdl_ptr - specpdl; + struct gcpro gcpro1; Lisp_Object val; + + GCPRO1 (sexpr); specbind (Qinhibit_redisplay, Qt); val = internal_condition_case_1 (Feval, sexpr, Qerror, eval_handler); + UNGCPRO; + return unbind_to (count, val); +} + + +/* Call function ARGS[0] with arguments ARGS[1] to ARGS[NARGS - 1]. + Return the result, or nil if something went wrong. */ + +Lisp_Object +call_function (nargs, args) + int nargs; + Lisp_Object *args; +{ + int count = specpdl_ptr - specpdl; + Lisp_Object val; + struct gcpro gcpro1; + + GCPRO1 (args[0]); + gcpro1.nvars = nargs; + specbind (Qinhibit_redisplay, Qt); + val = internal_condition_case_2 (Ffuncall, nargs, args, Qerror, + eval_handler); + UNGCPRO; return unbind_to (count, val); } @@ -2373,20 +2399,18 @@ handle_single_display_prop (it, prop, object, position) steps = - steps; it->face_id = smaller_face (it->f, it->face_id, steps); } - else if (SYMBOLP (it->font_height)) + else if (FUNCTIONP (it->font_height)) { /* Call function with current height as argument. Value is the new height. */ - Lisp_Object form, height; - struct gcpro gcpro1; + Lisp_Object args[2], height; + + args[0] = it->font_height; + args[1] = face->lface[LFACE_HEIGHT_INDEX]; + height = call_function (2, args); - height = face->lface[LFACE_HEIGHT_INDEX]; - form = Fcons (it->font_height, Fcons (height, Qnil)); - GCPRO1 (form); - height = eval_form (form); if (NUMBERP (height)) new_height = XFLOATINT (height); - UNGCPRO; } else if (NUMBERP (it->font_height)) {