unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juanma Barranquero <lekktu@gmail.com>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: 10578@debbugs.gnu.org
Subject: bug#10578: 24.0.92; No png images on OpenSUSE 12.1
Date: Thu, 26 Jan 2012 05:26:43 +0100	[thread overview]
Message-ID: <CAAeL0SQgNDtQ0nEzCinpamnsVH_+rM7jgwSymV7Dwt-3a08GXw@mail.gmail.com> (raw)
In-Reply-To: <87y5svinp8.fsf@gnus.org>

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);
+}
+

 \f
 /***********************************************************************





  reply	other threads:[~2012-01-26  4:26 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-22 16:12 bug#10578: 24.0.92; No png images on OpenSUSE 12.1 Lars Ingebrigtsen
2012-01-22 16:30 ` Eli Zaretskii
2012-01-22 16:50   ` Lars Magne Ingebrigtsen
2012-01-22 16:59     ` Achim Gratz
2012-01-22 17:02     ` Andreas Schwab
2012-01-25 19:25       ` Lars Ingebrigtsen
2012-01-22 17:51     ` Eli Zaretskii
2012-01-22 18:12       ` Eli Zaretskii
2012-01-22 19:32         ` Juanma Barranquero
2012-01-22 20:41           ` Eli Zaretskii
2012-01-22 21:25             ` Juanma Barranquero
2012-01-22 21:38               ` Juanma Barranquero
2012-01-23  1:11             ` Juanma Barranquero
2012-01-25 19:31               ` Lars Ingebrigtsen
2012-01-26  4:26                 ` Juanma Barranquero [this message]
2012-01-26  5:43                   ` Eli Zaretskii
2012-01-26 12:27                     ` Juanma Barranquero
2012-01-26 13:45                       ` Eli Zaretskii
2012-01-26 14:59                         ` Juanma Barranquero
2012-01-26 17:22                         ` Juanma Barranquero
2012-01-26 17:26                           ` Juanma Barranquero
2016-02-08  6:18                           ` Lars Ingebrigtsen
2016-02-08 18:17                             ` Eli Zaretskii
2016-02-09  0:13                               ` Lars Ingebrigtsen
2016-02-09  0:17                                 ` Lars Ingebrigtsen
2016-02-09  0:23                                 ` Lars Ingebrigtsen
2016-02-09  3:41                                   ` Eli Zaretskii
2012-01-25 19:28       ` Lars Ingebrigtsen
2012-01-26  1:49         ` Stefan Monnier
2012-01-26 17:21         ` Achim Gratz
2012-01-22 16:46 ` Achim Gratz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAAeL0SQgNDtQ0nEzCinpamnsVH_+rM7jgwSymV7Dwt-3a08GXw@mail.gmail.com \
    --to=lekktu@gmail.com \
    --cc=10578@debbugs.gnu.org \
    --cc=larsi@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).