Subject: Re: bug#10578: 24.0.92; No png images on OpenSUSE 12.1

From: Juanma Barranquero <[email-masked]>
Date: Mon, 23 Jan 2012 02:11:42 +0100

On Sun, Jan 22, 2012 at 21:41, Eli Zaretskii <[email-masked]> wrote:

> How about if you try doing that?

The simplest way is just to warn with a fixed message, as in the attached patch.

If we want to warn with the real message for image_error, either we
duplicate the Fformat call in add_to_log, which seems a waste, or we
add some function xdisp.c:add_to_log_and_warn. Alternatively,
repurposing add_to_log to also (optionally) warn wouldn't be
difficult, as it is used only nine times in the sources.

In any case, that kind of warning can be intrusive, because
display-warning keeps displaying the *Warnings* buffer. For example,
if I load libpng12 in a png14-compiled Emacs and visit a PNG file, I
get a string of 9 warnings, and 3 more each time I try to advance the
cursor. I think it wouldn't be much of a problem with image_error,
because the errors are caused by displaying images, and as soon as you
kill the corresponding buffer you're OK.

    Juanma

=== modified file 'src/image.c'
--- src/image.c	2012-01-19 07:21:25 +0000
+++ src/image.c	2012-01-22 22:22:31 +0000
@@ -676,7 +676,14 @@
 static void
 image_error (const char *format, Lisp_Object arg1, Lisp_Object arg2)
 {
+  Lisp_Object warning[3];
+
   add_to_log (format, arg1, arg2);
+  warning[0] = intern ("image");
+  warning[1] = build_string ("Image error, please check *Messages*");
+  warning[2] = intern (":error");
+  Vdelayed_warnings_list = Fcons (Flist (3, warning),
+                                  Vdelayed_warnings_list);
 }