1 new commit in XEmacs:
https://bitbucket.org/xemacs/xemacs/commits/da34f595fb4e/
Changeset: da34f595fb4e
User: kehoea
Date: 2017-11-17 08:22:15+00:00
Summary: New error_or_quit_failed_instantiator_in_domain(), reduce *Message-Log*
spam.
src/ChangeLog addition:
2017-11-17 Aidan Kehoe <kehoea(a)parhasard.net>
* specifier.c (error_or_quit_failed_instantiator_in_domain): New.
The first time instantiation has failed for INSTANTIATOR in
DOMAIN, throw an error. Otherwise, quit. Helpful for stopping an
error message on every redisplay for an invalid instantiator.
* fontcolor.c (color_instantiate): Use it.
* glyphs-eimage.c (jpeg_instantiate): Use it.
* glyphs-x.c (init_image_instance_from_x_image): Use it.
* glyphs-x.c (image_instance_add_x_image): Use it.
* glyphs-x.c (x_xpm_instantiate): Use it.
* glyphs.c (image_instantiate): Use it.
* lisp.h: Declare it.
* specifier.c (vars_of_specifier):
Make the weak alist that the function uses available at dump
time.
Affected #: 7 files
diff -r 405c07ae230be01c54b036bab07d0c684f3f15d6 -r
da34f595fb4e9234454846ec33da1d2c274998c2 src/ChangeLog
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,20 @@
+2017-11-17 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * specifier.c (error_or_quit_failed_instantiator_in_domain): New.
+ The first time instantiation has failed for INSTANTIATOR in
+ DOMAIN, throw an error. Otherwise, quit. Helpful for stopping an
+ error message on every redisplay for an invalid instantiator.
+ * fontcolor.c (color_instantiate): Use it.
+ * glyphs-eimage.c (jpeg_instantiate): Use it.
+ * glyphs-x.c (init_image_instance_from_x_image): Use it.
+ * glyphs-x.c (image_instance_add_x_image): Use it.
+ * glyphs-x.c (x_xpm_instantiate): Use it.
+ * glyphs.c (image_instantiate): Use it.
+ * lisp.h: Declare it.
+ * specifier.c (vars_of_specifier):
+ Make the weak alist that the function uses available at dump
+ time.
+
2017-11-15 Aidan Kehoe <kehoea(a)parhasard.net>
* Makefile.in.in ($(RAW_EXE)):
diff -r 405c07ae230be01c54b036bab07d0c684f3f15d6 -r
da34f595fb4e9234454846ec33da1d2c274998c2 src/fontcolor.c
--- a/src/fontcolor.c
+++ b/src/fontcolor.c
@@ -639,13 +639,16 @@
if (DEVICE_TTY_P (d))
return Vthe_null_color_instance;
else
- gui_error ("Color instantiator [] only valid on TTY's",
- device);
-
+ error_or_quit_failed_instantiator_in_domain
+ ("Color instantiator [] only valid on TTYs", instantiator,
+ domain);
case 1:
if (NILP (COLOR_SPECIFIER_FACE (XCOLOR_SPECIFIER (specifier))))
- gui_error ("Color specifier not attached to a face",
- instantiator);
+ {
+ error_or_quit_failed_instantiator_in_domain
+ ("Color specifier not attached to a face", instantiator,
+ domain);
+ }
return (FACE_PROPERTY_INSTANCE_1
(Fget_face (XVECTOR_DATA (instantiator)[0]),
COLOR_SPECIFIER_FACE_PROPERTY
@@ -667,8 +670,8 @@
if (DEVICE_TTY_P (d))
return Vthe_null_color_instance;
else
- gui_error ("Color instantiator [] only valid on TTY's",
- device);
+ error_or_quit_failed_instantiator_in_domain
+ ("Color instantiator [] only valid on TTYs", instantiator, domain);
}
else
ABORT (); /* The spec validation routines are screwed up. */
diff -r 405c07ae230be01c54b036bab07d0c684f3f15d6 -r
da34f595fb4e9234454846ec33da1d2c274998c2 src/glyphs-eimage.c
--- a/src/glyphs-eimage.c
+++ b/src/glyphs-eimage.c
@@ -387,15 +387,18 @@
*/
{
- Lisp_Object errstring;
Extbyte buffer[JMSG_LENGTH_MAX];
+ Ibyte *ibuffer;
/* Create the message */
(*cinfo.err->format_message) ((j_common_ptr) &cinfo, buffer);
- errstring = build_extstring (buffer, Qjpeg_error_message_encoding);
- signal_image_error_2 ("JPEG decoding error",
- errstring, instantiator);
+ TO_INTERNAL_FORMAT (C_STRING, buffer, C_STRING_ALLOCA, ibuffer,
+ Qjpeg_error_message_encoding);
+ error_or_quit_failed_instantiator_in_domain ((const Ascbyte *) ibuffer,
+ instantiator,
+ IMAGE_INSTANCE_DOMAIN
+ (ii));
}
}
@@ -453,12 +456,23 @@
pixels_sq =
(UINT_64_BIT) cinfo.output_width * (UINT_64_BIT) cinfo.output_height;
if (pixels_sq > ((size_t) -1) / 3)
- signal_image_error ("JPEG image too large to instantiate",
instantiator);
+ {
+ error_or_quit_failed_instantiator_in_domain ("JPEG image too large to"
+ " instantiate",
+ instantiator,
+ IMAGE_INSTANCE_DOMAIN
+ (ii));
+ }
unwind.eimage =
xnew_binbytes (cinfo.output_width * cinfo.output_height * 3);
if (!unwind.eimage)
- signal_image_error("Unable to allocate enough memory for image",
instantiator);
-
+ {
+ error_or_quit_failed_instantiator_in_domain ("Unable to allocate "
+ "enough memory for
image",
+ instantiator,
+ IMAGE_INSTANCE_DOMAIN
+ (ii));
+ }
{
JSAMPARRAY row_buffer; /* Output row buffer */
JSAMPLE *jp;
diff -r 405c07ae230be01c54b036bab07d0c684f3f15d6 -r
da34f595fb4e9234454846ec33da1d2c274998c2 src/glyphs-x.c
--- a/src/glyphs-x.c
+++ b/src/glyphs-x.c
@@ -936,13 +936,19 @@
pixmap = XCreatePixmap (dpy, d, ximage->width,
ximage->height, ximage->depth);
if (!pixmap)
- gui_error ("Unable to create pixmap", instantiator);
+ {
+ error_or_quit_failed_instantiator_in_domain ("Unable to create pixmap",
+ instantiator,
+ IMAGE_INSTANCE_DOMAIN (ii));
+ }
gc = XCreateGC (dpy, pixmap, 0, NULL);
if (!gc)
{
XFreePixmap (dpy, pixmap);
- gui_error ("Unable to create GC", instantiator);
+ error_or_quit_failed_instantiator_in_domain ("Unable to create GC",
+ instantiator,
+ IMAGE_INSTANCE_DOMAIN (ii));
}
XPutImage (dpy, pixmap, gc, ximage, 0, 0, 0, 0,
@@ -989,13 +995,19 @@
pixmap = XCreatePixmap (dpy, d, ximage->width,
ximage->height, ximage->depth);
if (!pixmap)
- gui_error ("Unable to create pixmap", instantiator);
+ {
+ error_or_quit_failed_instantiator_in_domain ("Unable to create pixmap",
+ instantiator,
+ IMAGE_INSTANCE_DOMAIN (ii));
+ }
gc = XCreateGC (dpy, pixmap, 0, NULL);
if (!gc)
{
XFreePixmap (dpy, pixmap);
- gui_error ("Unable to create GC", instantiator);
+ error_or_quit_failed_instantiator_in_domain ("Unable to create GC",
+ instantiator,
+ IMAGE_INSTANCE_DOMAIN (ii));
}
XPutImage (dpy, pixmap, gc, ximage, 0, 0, 0, 0,
@@ -1494,13 +1506,21 @@
if (force_mono)
{
/* second time; blow out. */
- gui_error ("XPM color allocation failed", data);
+ error_or_quit_failed_instantiator_in_domain ("XPM color
allocation"
+ " failed",
+ instantiator,
+ IMAGE_INSTANCE_DOMAIN
+ (ii));
}
else
{
/* second time; blow out. */
if (! (dest_mask & IMAGE_MONO_PIXMAP_MASK))
- gui_error ("XPM color allocation failed", data);
+ {
+ error_or_quit_failed_instantiator_in_domain
+ ("XPM color allocation failed", instantiator,
+ IMAGE_INSTANCE_DOMAIN (ii));
+ }
force_mono = 1;
IMAGE_INSTANCE_TYPE (ii) = IMAGE_MONO_PIXMAP;
goto retry;
@@ -1513,10 +1533,18 @@
}
default:
{
+ Ascbyte errbuf[sizeof ("Parsing pixmap data: unknown error code: %d")
+ + DECIMAL_PRINT_SIZE (result) + 1];
+
xpm_free (&xpmattrs);
- signal_error_2 (Qgui_error,
- "Parsing pixmap data: unknown error code",
- make_fixnum (result), data);
+
+ emacs_snprintf ((Ibyte *) errbuf, sizeof (errbuf),
+ "Parsing pixmap data: unknown error code: %d",
+ result);
+ error_or_quit_failed_instantiator_in_domain (errbuf,
+ instantiator,
+ IMAGE_INSTANCE_DOMAIN
+ (ii));
}
}
diff -r 405c07ae230be01c54b036bab07d0c684f3f15d6 -r
da34f595fb4e9234454846ec33da1d2c274998c2 src/glyphs.c
--- a/src/glyphs.c
+++ b/src/glyphs.c
@@ -3422,7 +3422,12 @@
#endif
}
else if (NILP (instance))
- gui_error ("Can't instantiate image (probably cached)", instantiator);
+ {
+ error_or_quit_failed_instantiator_in_domain ("Can't instantiate
"
+ "image (probably "
+ "cached)",
instantiator,
+ domain);
+ }
/* We found an instance. However, because we are using the glyph
as the hash key instead of the instantiator, the current
diff -r 405c07ae230be01c54b036bab07d0c684f3f15d6 -r
da34f595fb4e9234454846ec33da1d2c274998c2 src/lisp.h
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -6043,6 +6043,10 @@
extern Lisp_Object Vsynchronous_sounds;
/* Defined in specifier.c */
+DECLARE_DOESNT_RETURN (error_or_quit_failed_instantiator_in_domain
+ (const Ascbyte *, Lisp_Object instantiator,
+ Lisp_Object domain));
+
EXFUN (Fadd_spec_to_specifier, 5);
EXFUN (Fspecifier_spec_list, 4);
diff -r 405c07ae230be01c54b036bab07d0c684f3f15d6 -r
da34f595fb4e9234454846ec33da1d2c274998c2 src/specifier.c
--- a/src/specifier.c
+++ b/src/specifier.c
@@ -111,7 +111,53 @@
EXFUN (Fspecifier_specs, 4);
EXFUN (Fremove_specifier, 4);
-
+
+static Lisp_Object Vfailed_instantiator_domain_warned_list;
+extern Lisp_Object Vcatch_everything_tag;
+
+/* Give a GUI error that INSTANTIATOR could not be instantiated in DOMAIN. If
+ a corresponding error was already signaled for the same INSTANTIATOR,
+ DOMAIN pair, signal Qquit, which will be silent for the likely wrapping
+ call_trapping_errors(). Without this--when we called gui_error()
+ directly--we would get an error and a backtrace in the message area on each
+ redisplay, which is not practical for getting work done. */
+
+DOESNT_RETURN
+error_or_quit_failed_instantiator_in_domain (const Ascbyte *reason,
+ Lisp_Object instantiator,
+ Lisp_Object domain)
+{
+ Lisp_Object instantiator_domains =
+ assq_no_quit (instantiator,
+ XWEAK_LIST_LIST (Vfailed_instantiator_domain_warned_list));
+ Lisp_Object found_domain = Qnil;
+
+ if (!NILP (instantiator_domains)
+ &&
+ !NILP ((found_domain
+ = memq_no_quit (domain,
+ XWEAK_LIST_LIST (XCDR (instantiator_domains))))))
+ {
+ Fsignal (Qquit, Qnil); /* Not displayed by call_trapping_errors(). */
+ }
+
+ if (NILP (instantiator_domains))
+ {
+ instantiator_domains = make_weak_list (WEAK_LIST_SIMPLE);
+ XWEAK_LIST_LIST (Vfailed_instantiator_domain_warned_list)
+ = Facons (instantiator, instantiator_domains,
+ XWEAK_LIST_LIST (Vfailed_instantiator_domain_warned_list));
+ XWEAK_LIST_LIST (instantiator_domains) = list1 (domain);
+ }
+ else
+ {
+ instantiator_domains = XCDR (instantiator_domains);
+ XWEAK_LIST_LIST (instantiator_domains)
+ = Fcons (domain, XWEAK_LIST_LIST (instantiator_domains));
+ }
+
+ signal_error_2 (Qgui_error, reason, instantiator, domain);
+}
/************************************************************************/
/* Specifier object methods */
@@ -3983,4 +4029,7 @@
Vcharset_tag_lists =
make_lisp_hash_table (50, HASH_TABLE_NON_WEAK, Qeq);
staticpro (&Vcharset_tag_lists);
+
+ Vfailed_instantiator_domain_warned_list = make_weak_list (WEAK_LIST_ASSOC);
+ staticpro (&Vfailed_instantiator_domain_warned_list);
}
Repository URL:
https://bitbucket.org/xemacs/xemacs/
--
This is a commit notification from
bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.