diff options
| author | Gerd Moellmann | 1999-09-23 22:17:44 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 1999-09-23 22:17:44 +0000 |
| commit | 1b8f7fbca2579aee56fa722dcff42a06bdf18e4a (patch) | |
| tree | 664c299cb23084752c0ed3e3baba9a4f7cea3001 | |
| parent | 937248bc7fe010f1e56dea8613e671ad6bb6e138 (diff) | |
| download | emacs-1b8f7fbca2579aee56fa722dcff42a06bdf18e4a.tar.gz emacs-1b8f7fbca2579aee56fa722dcff42a06bdf18e4a.zip | |
(load_pixmap): Call add_to_log without frame parameter.
(load_face_font_or_fontset, load_color,
merge_face_vector_with_property): Ditto.
(add_to_log): Move to xdisp.c.
| -rw-r--r-- | src/xfaces.c | 87 |
1 files changed, 21 insertions, 66 deletions
diff --git a/src/xfaces.c b/src/xfaces.c index c50a8463744..0367a925c88 100644 --- a/src/xfaces.c +++ b/src/xfaces.c | |||
| @@ -412,7 +412,6 @@ static int load_pixmap P_ ((struct frame *, Lisp_Object, unsigned *, unsigned *) | |||
| 412 | static char *xstrdup P_ ((char *)); | 412 | static char *xstrdup P_ ((char *)); |
| 413 | static unsigned char *xstrlwr P_ ((unsigned char *)); | 413 | static unsigned char *xstrlwr P_ ((unsigned char *)); |
| 414 | static void signal_error P_ ((char *, Lisp_Object)); | 414 | static void signal_error P_ ((char *, Lisp_Object)); |
| 415 | static void add_to_log P_ ((struct frame *, char *, Lisp_Object, Lisp_Object)); | ||
| 416 | static struct frame *frame_or_selected_frame P_ ((Lisp_Object, int)); | 415 | static struct frame *frame_or_selected_frame P_ ((Lisp_Object, int)); |
| 417 | static void load_face_font_or_fontset P_ ((struct frame *, struct face *, char *, int)); | 416 | static void load_face_font_or_fontset P_ ((struct frame *, struct face *, char *, int)); |
| 418 | static void load_face_colors P_ ((struct frame *, struct face *, Lisp_Object *)); | 417 | static void load_face_colors P_ ((struct frame *, struct face *, Lisp_Object *)); |
| @@ -593,50 +592,6 @@ signal_error (s, arg) | |||
| 593 | } | 592 | } |
| 594 | 593 | ||
| 595 | 594 | ||
| 596 | /* Display a message with format string FORMAT and arguments ARG1 and | ||
| 597 | ARG2 on frame F. Used to display errors if fonts, bitmaps, colors | ||
| 598 | etc. for a realized face on frame F cannot be loaded. (If we would | ||
| 599 | signal an error in these cases, we would end up in an infinite | ||
| 600 | recursion because this would stop realization, and the redisplay | ||
| 601 | triggered by the signal would try to realize that same face again.) | ||
| 602 | |||
| 603 | If basic faces of F are not realized, just add the message to the | ||
| 604 | messages buffer "*Messages*". Because Fmessage calls | ||
| 605 | echo_area_display which tries to realize basic faces again, we would | ||
| 606 | otherwise also end in an infinite recursion. */ | ||
| 607 | |||
| 608 | static void | ||
| 609 | add_to_log (f, format, arg1, arg2) | ||
| 610 | struct frame *f; | ||
| 611 | char *format; | ||
| 612 | Lisp_Object arg1, arg2; | ||
| 613 | { | ||
| 614 | Lisp_Object args[3]; | ||
| 615 | Lisp_Object nargs; | ||
| 616 | Lisp_Object msg; | ||
| 617 | char *buffer; | ||
| 618 | extern int waiting_for_input; | ||
| 619 | |||
| 620 | /* Function note_mouse_highlight calls face_at_buffer_position which | ||
| 621 | may realize a face. If some attribute of that face is invalid, | ||
| 622 | say an invalid color, don't display an error to avoid calling | ||
| 623 | Lisp from XTread_socket. */ | ||
| 624 | if (waiting_for_input) | ||
| 625 | return; | ||
| 626 | |||
| 627 | nargs = make_number (DIM (args)); | ||
| 628 | args[0] = build_string (format); | ||
| 629 | args[1] = arg1; | ||
| 630 | args[2] = arg2; | ||
| 631 | msg = Fformat (nargs, args); | ||
| 632 | |||
| 633 | /* Log the error, but don't display it in the echo area. This | ||
| 634 | proves to be annoying in many cases. */ | ||
| 635 | buffer = LSTRDUPA (msg); | ||
| 636 | message_dolog (buffer, strlen (buffer), 1, 0); | ||
| 637 | } | ||
| 638 | |||
| 639 | |||
| 640 | /* If FRAME is nil, return a pointer to the selected frame. | 595 | /* If FRAME is nil, return a pointer to the selected frame. |
| 641 | Otherwise, check that FRAME is a live frame, and return a pointer | 596 | Otherwise, check that FRAME is a live frame, and return a pointer |
| 642 | to it. NPARAM is the parameter number of FRAME, for | 597 | to it. NPARAM is the parameter number of FRAME, for |
| @@ -954,7 +909,7 @@ load_pixmap (f, name, w_ptr, h_ptr) | |||
| 954 | 909 | ||
| 955 | if (bitmap_id < 0) | 910 | if (bitmap_id < 0) |
| 956 | { | 911 | { |
| 957 | add_to_log (f, "Invalid or undefined bitmap %s", name, Qnil); | 912 | add_to_log ("Invalid or undefined bitmap %s", name, Qnil); |
| 958 | bitmap_id = 0; | 913 | bitmap_id = 0; |
| 959 | 914 | ||
| 960 | if (w_ptr) | 915 | if (w_ptr) |
| @@ -1072,10 +1027,10 @@ load_face_font_or_fontset (f, face, font_name, fontset) | |||
| 1072 | } | 1027 | } |
| 1073 | } | 1028 | } |
| 1074 | else if (fontset >= 0) | 1029 | else if (fontset >= 0) |
| 1075 | add_to_log (f, "Unable to load ASCII font of fontset %d", | 1030 | add_to_log ("Unable to load ASCII font of fontset %d", |
| 1076 | make_number (fontset), Qnil); | 1031 | make_number (fontset), Qnil); |
| 1077 | else if (font_name) | 1032 | else if (font_name) |
| 1078 | add_to_log (f, "Unable to load font %s", | 1033 | add_to_log ("Unable to load font %s", |
| 1079 | build_string (font_name), Qnil); | 1034 | build_string (font_name), Qnil); |
| 1080 | } | 1035 | } |
| 1081 | 1036 | ||
| @@ -1197,7 +1152,7 @@ load_color (f, face, name, target_index) | |||
| 1197 | to the values in an existing cell. */ | 1152 | to the values in an existing cell. */ |
| 1198 | if (!defined_color (f, XSTRING (name)->data, &color, 1)) | 1153 | if (!defined_color (f, XSTRING (name)->data, &color, 1)) |
| 1199 | { | 1154 | { |
| 1200 | add_to_log (f, "Unable to load color %s", name, Qnil); | 1155 | add_to_log ("Unable to load color %s", name, Qnil); |
| 1201 | 1156 | ||
| 1202 | switch (target_index) | 1157 | switch (target_index) |
| 1203 | { | 1158 | { |
| @@ -1418,7 +1373,7 @@ load_color (f, face, name, target_index) | |||
| 1418 | if (INTEGERP (color)) | 1373 | if (INTEGERP (color)) |
| 1419 | return (unsigned long)XINT (color); | 1374 | return (unsigned long)XINT (color); |
| 1420 | 1375 | ||
| 1421 | add_to_log (f, "Unable to load color %s", name, Qnil); | 1376 | add_to_log ("Unable to load color %s", name, Qnil); |
| 1422 | 1377 | ||
| 1423 | switch (target_index) | 1378 | switch (target_index) |
| 1424 | { | 1379 | { |
| @@ -2852,7 +2807,7 @@ merge_face_vector_with_property (f, to, prop) | |||
| 2852 | to[LFACE_BACKGROUND_INDEX] = color_name; | 2807 | to[LFACE_BACKGROUND_INDEX] = color_name; |
| 2853 | } | 2808 | } |
| 2854 | else | 2809 | else |
| 2855 | add_to_log (f, "Invalid face color", color_name, Qnil); | 2810 | add_to_log ("Invalid face color", color_name, Qnil); |
| 2856 | } | 2811 | } |
| 2857 | else if (SYMBOLP (first) | 2812 | else if (SYMBOLP (first) |
| 2858 | && *XSYMBOL (first)->name->data == ':') | 2813 | && *XSYMBOL (first)->name->data == ':') |
| @@ -2868,14 +2823,14 @@ merge_face_vector_with_property (f, to, prop) | |||
| 2868 | if (STRINGP (value)) | 2823 | if (STRINGP (value)) |
| 2869 | to[LFACE_FAMILY_INDEX] = value; | 2824 | to[LFACE_FAMILY_INDEX] = value; |
| 2870 | else | 2825 | else |
| 2871 | add_to_log (f, "Illegal face font family", value, Qnil); | 2826 | add_to_log ("Illegal face font family", value, Qnil); |
| 2872 | } | 2827 | } |
| 2873 | else if (EQ (keyword, QCheight)) | 2828 | else if (EQ (keyword, QCheight)) |
| 2874 | { | 2829 | { |
| 2875 | if (INTEGERP (value)) | 2830 | if (INTEGERP (value)) |
| 2876 | to[LFACE_HEIGHT_INDEX] = value; | 2831 | to[LFACE_HEIGHT_INDEX] = value; |
| 2877 | else | 2832 | else |
| 2878 | add_to_log (f, "Illegal face font height", value, Qnil); | 2833 | add_to_log ("Illegal face font height", value, Qnil); |
| 2879 | } | 2834 | } |
| 2880 | else if (EQ (keyword, QCweight)) | 2835 | else if (EQ (keyword, QCweight)) |
| 2881 | { | 2836 | { |
| @@ -2883,7 +2838,7 @@ merge_face_vector_with_property (f, to, prop) | |||
| 2883 | && face_numeric_weight (value) >= 0) | 2838 | && face_numeric_weight (value) >= 0) |
| 2884 | to[LFACE_WEIGHT_INDEX] = value; | 2839 | to[LFACE_WEIGHT_INDEX] = value; |
| 2885 | else | 2840 | else |
| 2886 | add_to_log (f, "Illegal face weight", value, Qnil); | 2841 | add_to_log ("Illegal face weight", value, Qnil); |
| 2887 | } | 2842 | } |
| 2888 | else if (EQ (keyword, QCslant)) | 2843 | else if (EQ (keyword, QCslant)) |
| 2889 | { | 2844 | { |
| @@ -2891,7 +2846,7 @@ merge_face_vector_with_property (f, to, prop) | |||
| 2891 | && face_numeric_slant (value) >= 0) | 2846 | && face_numeric_slant (value) >= 0) |
| 2892 | to[LFACE_SLANT_INDEX] = value; | 2847 | to[LFACE_SLANT_INDEX] = value; |
| 2893 | else | 2848 | else |
| 2894 | add_to_log (f, "Illegal face slant", value, Qnil); | 2849 | add_to_log ("Illegal face slant", value, Qnil); |
| 2895 | } | 2850 | } |
| 2896 | else if (EQ (keyword, QCunderline)) | 2851 | else if (EQ (keyword, QCunderline)) |
| 2897 | { | 2852 | { |
| @@ -2900,7 +2855,7 @@ merge_face_vector_with_property (f, to, prop) | |||
| 2900 | || STRINGP (value)) | 2855 | || STRINGP (value)) |
| 2901 | to[LFACE_UNDERLINE_INDEX] = value; | 2856 | to[LFACE_UNDERLINE_INDEX] = value; |
| 2902 | else | 2857 | else |
| 2903 | add_to_log (f, "Illegal face underline", value, Qnil); | 2858 | add_to_log ("Illegal face underline", value, Qnil); |
| 2904 | } | 2859 | } |
| 2905 | else if (EQ (keyword, QCoverline)) | 2860 | else if (EQ (keyword, QCoverline)) |
| 2906 | { | 2861 | { |
| @@ -2909,7 +2864,7 @@ merge_face_vector_with_property (f, to, prop) | |||
| 2909 | || STRINGP (value)) | 2864 | || STRINGP (value)) |
| 2910 | to[LFACE_OVERLINE_INDEX] = value; | 2865 | to[LFACE_OVERLINE_INDEX] = value; |
| 2911 | else | 2866 | else |
| 2912 | add_to_log (f, "Illegal face overline", value, Qnil); | 2867 | add_to_log ("Illegal face overline", value, Qnil); |
| 2913 | } | 2868 | } |
| 2914 | else if (EQ (keyword, QCstrike_through)) | 2869 | else if (EQ (keyword, QCstrike_through)) |
| 2915 | { | 2870 | { |
| @@ -2918,7 +2873,7 @@ merge_face_vector_with_property (f, to, prop) | |||
| 2918 | || STRINGP (value)) | 2873 | || STRINGP (value)) |
| 2919 | to[LFACE_STRIKE_THROUGH_INDEX] = value; | 2874 | to[LFACE_STRIKE_THROUGH_INDEX] = value; |
| 2920 | else | 2875 | else |
| 2921 | add_to_log (f, "Illegal face strike-through", value, Qnil); | 2876 | add_to_log ("Illegal face strike-through", value, Qnil); |
| 2922 | } | 2877 | } |
| 2923 | else if (EQ (keyword, QCbox)) | 2878 | else if (EQ (keyword, QCbox)) |
| 2924 | { | 2879 | { |
| @@ -2930,7 +2885,7 @@ merge_face_vector_with_property (f, to, prop) | |||
| 2930 | || NILP (value)) | 2885 | || NILP (value)) |
| 2931 | to[LFACE_BOX_INDEX] = value; | 2886 | to[LFACE_BOX_INDEX] = value; |
| 2932 | else | 2887 | else |
| 2933 | add_to_log (f, "Illegal face box", value, Qnil); | 2888 | add_to_log ("Illegal face box", value, Qnil); |
| 2934 | } | 2889 | } |
| 2935 | else if (EQ (keyword, QCinverse_video) | 2890 | else if (EQ (keyword, QCinverse_video) |
| 2936 | || EQ (keyword, QCreverse_video)) | 2891 | || EQ (keyword, QCreverse_video)) |
| @@ -2938,21 +2893,21 @@ merge_face_vector_with_property (f, to, prop) | |||
| 2938 | if (EQ (value, Qt) || NILP (value)) | 2893 | if (EQ (value, Qt) || NILP (value)) |
| 2939 | to[LFACE_INVERSE_INDEX] = value; | 2894 | to[LFACE_INVERSE_INDEX] = value; |
| 2940 | else | 2895 | else |
| 2941 | add_to_log (f, "Illegal face inverse-video", value, Qnil); | 2896 | add_to_log ("Illegal face inverse-video", value, Qnil); |
| 2942 | } | 2897 | } |
| 2943 | else if (EQ (keyword, QCforeground)) | 2898 | else if (EQ (keyword, QCforeground)) |
| 2944 | { | 2899 | { |
| 2945 | if (STRINGP (value)) | 2900 | if (STRINGP (value)) |
| 2946 | to[LFACE_FOREGROUND_INDEX] = value; | 2901 | to[LFACE_FOREGROUND_INDEX] = value; |
| 2947 | else | 2902 | else |
| 2948 | add_to_log (f, "Illegal face foreground", value, Qnil); | 2903 | add_to_log ("Illegal face foreground", value, Qnil); |
| 2949 | } | 2904 | } |
| 2950 | else if (EQ (keyword, QCbackground)) | 2905 | else if (EQ (keyword, QCbackground)) |
| 2951 | { | 2906 | { |
| 2952 | if (STRINGP (value)) | 2907 | if (STRINGP (value)) |
| 2953 | to[LFACE_BACKGROUND_INDEX] = value; | 2908 | to[LFACE_BACKGROUND_INDEX] = value; |
| 2954 | else | 2909 | else |
| 2955 | add_to_log (f, "Illegal face background", value, Qnil); | 2910 | add_to_log ("Illegal face background", value, Qnil); |
| 2956 | } | 2911 | } |
| 2957 | else if (EQ (keyword, QCstipple)) | 2912 | else if (EQ (keyword, QCstipple)) |
| 2958 | { | 2913 | { |
| @@ -2961,7 +2916,7 @@ merge_face_vector_with_property (f, to, prop) | |||
| 2961 | if (!NILP (pixmap_p)) | 2916 | if (!NILP (pixmap_p)) |
| 2962 | to[LFACE_STIPPLE_INDEX] = value; | 2917 | to[LFACE_STIPPLE_INDEX] = value; |
| 2963 | else | 2918 | else |
| 2964 | add_to_log (f, "Illegal face stipple", value, Qnil); | 2919 | add_to_log ("Illegal face stipple", value, Qnil); |
| 2965 | #endif | 2920 | #endif |
| 2966 | } | 2921 | } |
| 2967 | else if (EQ (keyword, QCwidth)) | 2922 | else if (EQ (keyword, QCwidth)) |
| @@ -2970,10 +2925,10 @@ merge_face_vector_with_property (f, to, prop) | |||
| 2970 | && face_numeric_swidth (value) >= 0) | 2925 | && face_numeric_swidth (value) >= 0) |
| 2971 | to[LFACE_SWIDTH_INDEX] = value; | 2926 | to[LFACE_SWIDTH_INDEX] = value; |
| 2972 | else | 2927 | else |
| 2973 | add_to_log (f, "Illegal face width", value, Qnil); | 2928 | add_to_log ("Illegal face width", value, Qnil); |
| 2974 | } | 2929 | } |
| 2975 | else | 2930 | else |
| 2976 | add_to_log (f, "Invalid attribute %s in face property", | 2931 | add_to_log ("Invalid attribute %s in face property", |
| 2977 | keyword, Qnil); | 2932 | keyword, Qnil); |
| 2978 | 2933 | ||
| 2979 | prop = XCDR (XCDR (prop)); | 2934 | prop = XCDR (XCDR (prop)); |
| @@ -2996,7 +2951,7 @@ merge_face_vector_with_property (f, to, prop) | |||
| 2996 | /* PROP ought to be a face name. */ | 2951 | /* PROP ought to be a face name. */ |
| 2997 | Lisp_Object lface = lface_from_face_name (f, prop, 0); | 2952 | Lisp_Object lface = lface_from_face_name (f, prop, 0); |
| 2998 | if (NILP (lface)) | 2953 | if (NILP (lface)) |
| 2999 | add_to_log (f, "Invalid face text property value: %s", prop, Qnil); | 2954 | add_to_log ("Invalid face text property value: %s", prop, Qnil); |
| 3000 | else | 2955 | else |
| 3001 | merge_face_vectors (XVECTOR (lface)->contents, to); | 2956 | merge_face_vectors (XVECTOR (lface)->contents, to); |
| 3002 | } | 2957 | } |