diff options
| author | Gerd Moellmann | 2000-10-05 19:29:05 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2000-10-05 19:29:05 +0000 |
| commit | 116d6f5cae9f9d226f34226b073de61228f1ea04 (patch) | |
| tree | 16b30aa280d13a6b3b0cdd302d06555ba8a6a1b8 /src | |
| parent | 1db0076e78b71009e98fc30cf02019c502da96b2 (diff) | |
| download | emacs-116d6f5cae9f9d226f34226b073de61228f1ea04.tar.gz emacs-116d6f5cae9f9d226f34226b073de61228f1ea04.zip | |
(handle_single_display_prop): Use safe_call1.
(safe_call): Renamed from call_function.
(safe_call1): New function.
(handle_fontified_prop): Use safe_call1 instead of call1.
(safe_eval): Renamed from eval_form.
(safe_eval_handler): Renamed from eval_handler.
(handle_single_display_prop, display_mode_element): Use safe_eval
instead of eval_form.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xdisp.c | 49 |
1 files changed, 30 insertions, 19 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index dfe7c3dd95d..1f656d52a39 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -664,7 +664,7 @@ static int string_char_and_length P_ ((unsigned char *, int, int *)); | |||
| 664 | static struct text_pos display_prop_end P_ ((struct it *, Lisp_Object, | 664 | static struct text_pos display_prop_end P_ ((struct it *, Lisp_Object, |
| 665 | struct text_pos)); | 665 | struct text_pos)); |
| 666 | static int compute_window_start_on_continuation_line P_ ((struct window *)); | 666 | static int compute_window_start_on_continuation_line P_ ((struct window *)); |
| 667 | static Lisp_Object eval_handler P_ ((Lisp_Object)); | 667 | static Lisp_Object safe_eval_handler P_ ((Lisp_Object)); |
| 668 | static void insert_left_trunc_glyphs P_ ((struct it *)); | 668 | static void insert_left_trunc_glyphs P_ ((struct it *)); |
| 669 | static struct glyph_row *get_overlay_arrow_glyph_row P_ ((struct window *)); | 669 | static struct glyph_row *get_overlay_arrow_glyph_row P_ ((struct window *)); |
| 670 | static void extend_face_to_end_of_line P_ ((struct it *)); | 670 | static void extend_face_to_end_of_line P_ ((struct it *)); |
| @@ -1089,10 +1089,10 @@ compute_string_pos (newpos, pos, string) | |||
| 1089 | Lisp form evaluation | 1089 | Lisp form evaluation |
| 1090 | ***********************************************************************/ | 1090 | ***********************************************************************/ |
| 1091 | 1091 | ||
| 1092 | /* Error handler for eval_form and call_function. */ | 1092 | /* Error handler for safe_eval and safe_call. */ |
| 1093 | 1093 | ||
| 1094 | static Lisp_Object | 1094 | static Lisp_Object |
| 1095 | eval_handler (arg) | 1095 | safe_eval_handler (arg) |
| 1096 | Lisp_Object arg; | 1096 | Lisp_Object arg; |
| 1097 | { | 1097 | { |
| 1098 | return Qnil; | 1098 | return Qnil; |
| @@ -1103,7 +1103,7 @@ eval_handler (arg) | |||
| 1103 | wrong. */ | 1103 | wrong. */ |
| 1104 | 1104 | ||
| 1105 | Lisp_Object | 1105 | Lisp_Object |
| 1106 | eval_form (sexpr) | 1106 | safe_eval (sexpr) |
| 1107 | Lisp_Object sexpr; | 1107 | Lisp_Object sexpr; |
| 1108 | { | 1108 | { |
| 1109 | int count = specpdl_ptr - specpdl; | 1109 | int count = specpdl_ptr - specpdl; |
| @@ -1112,7 +1112,7 @@ eval_form (sexpr) | |||
| 1112 | 1112 | ||
| 1113 | GCPRO1 (sexpr); | 1113 | GCPRO1 (sexpr); |
| 1114 | specbind (Qinhibit_redisplay, Qt); | 1114 | specbind (Qinhibit_redisplay, Qt); |
| 1115 | val = internal_condition_case_1 (Feval, sexpr, Qerror, eval_handler); | 1115 | val = internal_condition_case_1 (Feval, sexpr, Qerror, safe_eval_handler); |
| 1116 | UNGCPRO; | 1116 | UNGCPRO; |
| 1117 | return unbind_to (count, val); | 1117 | return unbind_to (count, val); |
| 1118 | } | 1118 | } |
| @@ -1122,7 +1122,7 @@ eval_form (sexpr) | |||
| 1122 | Return the result, or nil if something went wrong. */ | 1122 | Return the result, or nil if something went wrong. */ |
| 1123 | 1123 | ||
| 1124 | Lisp_Object | 1124 | Lisp_Object |
| 1125 | call_function (nargs, args) | 1125 | safe_call (nargs, args) |
| 1126 | int nargs; | 1126 | int nargs; |
| 1127 | Lisp_Object *args; | 1127 | Lisp_Object *args; |
| 1128 | { | 1128 | { |
| @@ -1134,12 +1134,26 @@ call_function (nargs, args) | |||
| 1134 | gcpro1.nvars = nargs; | 1134 | gcpro1.nvars = nargs; |
| 1135 | specbind (Qinhibit_redisplay, Qt); | 1135 | specbind (Qinhibit_redisplay, Qt); |
| 1136 | val = internal_condition_case_2 (Ffuncall, nargs, args, Qerror, | 1136 | val = internal_condition_case_2 (Ffuncall, nargs, args, Qerror, |
| 1137 | eval_handler); | 1137 | safe_eval_handler); |
| 1138 | UNGCPRO; | 1138 | UNGCPRO; |
| 1139 | return unbind_to (count, val); | 1139 | return unbind_to (count, val); |
| 1140 | } | 1140 | } |
| 1141 | 1141 | ||
| 1142 | 1142 | ||
| 1143 | /* Call function FN with one argument ARG. | ||
| 1144 | Return the result, or nil if something went wrong. */ | ||
| 1145 | |||
| 1146 | Lisp_Object | ||
| 1147 | safe_call1 (fn, arg) | ||
| 1148 | Lisp_Object fn, arg; | ||
| 1149 | { | ||
| 1150 | Lisp_Object args[2]; | ||
| 1151 | args[0] = fn; | ||
| 1152 | args[1] = arg; | ||
| 1153 | return safe_call (2, args); | ||
| 1154 | } | ||
| 1155 | |||
| 1156 | |||
| 1143 | 1157 | ||
| 1144 | /*********************************************************************** | 1158 | /*********************************************************************** |
| 1145 | Debugging | 1159 | Debugging |
| @@ -1891,7 +1905,7 @@ handle_fontified_prop (it) | |||
| 1891 | specbind (Qafter_change_functions, Qnil); | 1905 | specbind (Qafter_change_functions, Qnil); |
| 1892 | 1906 | ||
| 1893 | if (!CONSP (val) || EQ (XCAR (val), Qlambda)) | 1907 | if (!CONSP (val) || EQ (XCAR (val), Qlambda)) |
| 1894 | call1 (val, pos); | 1908 | safe_call1 (val, pos); |
| 1895 | else | 1909 | else |
| 1896 | { | 1910 | { |
| 1897 | Lisp_Object globals, fn; | 1911 | Lisp_Object globals, fn; |
| @@ -1917,11 +1931,11 @@ handle_fontified_prop (it) | |||
| 1917 | { | 1931 | { |
| 1918 | fn = XCAR (globals); | 1932 | fn = XCAR (globals); |
| 1919 | if (!EQ (fn, Qt)) | 1933 | if (!EQ (fn, Qt)) |
| 1920 | call1 (fn, pos); | 1934 | safe_call1 (fn, pos); |
| 1921 | } | 1935 | } |
| 1922 | } | 1936 | } |
| 1923 | else | 1937 | else |
| 1924 | call1 (fn, pos); | 1938 | safe_call1 (fn, pos); |
| 1925 | } | 1939 | } |
| 1926 | 1940 | ||
| 1927 | UNGCPRO; | 1941 | UNGCPRO; |
| @@ -2453,7 +2467,7 @@ handle_single_display_prop (it, prop, object, position) | |||
| 2453 | TEMP_SET_PT_BOTH (CHARPOS (end_pos), BYTEPOS (end_pos)); | 2467 | TEMP_SET_PT_BOTH (CHARPOS (end_pos), BYTEPOS (end_pos)); |
| 2454 | } | 2468 | } |
| 2455 | 2469 | ||
| 2456 | form = eval_form (form); | 2470 | form = safe_eval (form); |
| 2457 | 2471 | ||
| 2458 | if (BUFFERP (object)) | 2472 | if (BUFFERP (object)) |
| 2459 | TEMP_SET_PT_BOTH (CHARPOS (pt), BYTEPOS (pt)); | 2473 | TEMP_SET_PT_BOTH (CHARPOS (pt), BYTEPOS (pt)); |
| @@ -2493,12 +2507,9 @@ handle_single_display_prop (it, prop, object, position) | |||
| 2493 | { | 2507 | { |
| 2494 | /* Call function with current height as argument. | 2508 | /* Call function with current height as argument. |
| 2495 | Value is the new height. */ | 2509 | Value is the new height. */ |
| 2496 | Lisp_Object args[2], height; | 2510 | Lisp_Object height; |
| 2497 | 2511 | height = safe_call1 (it->font_height, | |
| 2498 | args[0] = it->font_height; | 2512 | face->lface[LFACE_HEIGHT_INDEX]); |
| 2499 | args[1] = face->lface[LFACE_HEIGHT_INDEX]; | ||
| 2500 | height = call_function (2, args); | ||
| 2501 | |||
| 2502 | if (NUMBERP (height)) | 2513 | if (NUMBERP (height)) |
| 2503 | new_height = XFLOATINT (height); | 2514 | new_height = XFLOATINT (height); |
| 2504 | } | 2515 | } |
| @@ -2519,7 +2530,7 @@ handle_single_display_prop (it, prop, object, position) | |||
| 2519 | int count = specpdl_ptr - specpdl; | 2530 | int count = specpdl_ptr - specpdl; |
| 2520 | 2531 | ||
| 2521 | specbind (Qheight, face->lface[LFACE_HEIGHT_INDEX]); | 2532 | specbind (Qheight, face->lface[LFACE_HEIGHT_INDEX]); |
| 2522 | value = eval_form (it->font_height); | 2533 | value = safe_eval (it->font_height); |
| 2523 | unbind_to (count, Qnil); | 2534 | unbind_to (count, Qnil); |
| 2524 | 2535 | ||
| 2525 | if (NUMBERP (value)) | 2536 | if (NUMBERP (value)) |
| @@ -12411,7 +12422,7 @@ display_mode_element (it, depth, field_width, precision, elt) | |||
| 12411 | struct gcpro gcpro1; | 12422 | struct gcpro gcpro1; |
| 12412 | Lisp_Object spec; | 12423 | Lisp_Object spec; |
| 12413 | 12424 | ||
| 12414 | spec = eval_form (XCAR (XCDR (elt))); | 12425 | spec = safe_eval (XCAR (XCDR (elt))); |
| 12415 | GCPRO1 (spec); | 12426 | GCPRO1 (spec); |
| 12416 | n += display_mode_element (it, depth, field_width - n, | 12427 | n += display_mode_element (it, depth, field_width - n, |
| 12417 | precision - n, spec); | 12428 | precision - n, spec); |