bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Juanma Barranquero
Subject: bug#10578: 24.0.92; No png images on OpenSUSE 12.1
Date: Thu, 26 Jan 2012 05:26:43 +0100

On Wed, Jan 25, 2012 at 20:31, Lars Ingebrigtsen <larsi@gnus.org> wrote:

> Perhaps it would be an idea to add a simple rate-limiting device?  That
> is, don't output the "Look in the *Messages* buffer" more often than,
> say, once per second.  Or minute.  Perhaps per ten seconds makes more
> sense, so that the message isn't as easily lost, but makes it possible
> to continue using Emacs.

In the attached patch, the warning is shown after 5 seconds of idle
time. Also, all warnings of type `display' are assumed to be
equivalent and only the most recent one is displayed; the rest are
discarded.

    Juanma



=== modified file 'lisp/subr.el'
--- lisp/subr.el        2012-01-23 02:10:36 +0000
+++ lisp/subr.el        2012-01-26 04:23:06 +0000
@@ -1879,7 +1879,31 @@
         (push warning collapsed)))
     (setq delayed-warnings-list (nreverse collapsed))))

+(defconst display-errors-idle-time 5.0
+  "Interval of idle time before warning about display errors.")
+
+(defvar display-errors-pending nil
+  "Internal use only.")
+
+(defun show-display-errors-when-idle ()
+  "Warn about display errors when Emacs is idle.
+Only the most recent error (possibly collapsed) is shown,
+after `display-errors-idle-time' seconds of idle time;
+the rest are assumed to be identical and discarded.
+Used from `delayed-warnings-hook' (which see)."
+  (let ((display-error (assq 'display delayed-warnings-list)))
+    (when display-error
+      (setq delayed-warnings-list (assq-delete-all 'display
+                                                   delayed-warnings-list))
+      (unless display-errors-pending
+        (setq display-errors-pending display-error)
+        (run-with-idle-timer display-errors-idle-time nil
+                             (lambda ()
+                               (apply 'display-warning display-errors-pending)
+                               (setq display-errors-pending nil)))))))
+
 (defvar delayed-warnings-hook '(collapse-delayed-warnings
+                                show-display-errors-when-idle
                                 display-delayed-warnings)
   "Normal hook run to process delayed warnings.
 Functions in this hook should access the `delayed-warnings-list'

=== modified file 'src/image.c'
--- src/image.c 2012-01-19 07:21:25 +0000
+++ src/image.c 2012-01-26 04:02:24 +0000
@@ -677,6 +677,7 @@
 image_error (const char *format, Lisp_Object arg1, Lisp_Object arg2)
 {
   add_to_log (format, arg1, arg2);
+  warn_about_display_error ();
 }



=== modified file 'src/lisp.h'
--- src/lisp.h  2012-01-19 07:21:25 +0000
+++ src/lisp.h  2012-01-26 04:02:15 +0000
@@ -2746,6 +2746,7 @@
 extern void redisplay (void);
 extern void redisplay_preserve_echo_area (int);
 extern void prepare_menu_bars (void);
+extern void warn_about_display_error (void);

 void set_frame_cursor_types (struct frame *, Lisp_Object);
 extern void syms_of_xdisp (void);

=== modified file 'src/xdisp.c'
--- src/xdisp.c 2012-01-19 07:21:25 +0000
+++ src/xdisp.c 2012-01-26 04:03:05 +0000
@@ -2326,6 +2326,7 @@
 safe_eval_handler (Lisp_Object arg)
 {
   add_to_log ("Error during redisplay: %S", arg, Qnil);
+  warn_about_display_error ();
   return Qnil;
 }

@@ -10612,6 +10613,18 @@
   return window_height_changed_p;
 }

+void
+warn_about_display_error (void)
+{
+  Lisp_Object warning[3];
+
+  warning[0] = intern ("display");
+  warning[1] = build_string ("Please check *Messages*");
+  warning[2] = intern (":error");
+  Vdelayed_warnings_list = Fcons (Flist (3, warning),
+                                  Vdelayed_warnings_list);
+}
+

 
 /***********************************************************************





reply via email to

[Prev in Thread] Current Thread [Next in Thread]