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 18:22:21 +0100

On Thu, Jan 26, 2012 at 14:45, Eli Zaretskii <address@hidden> wrote:

> To tell the truth, I don't like such vague warning, since the
> reference to *Messages* is not specific enough to be useful, IMO.  It
> is better to show some more specific text in the delayed warning
> itself.

OK, next iteration.

The following patch shows all display warnings (errors, in fact),
after 5 seconds of idle time.

It's quite simple because I've assumed every call to add_to_log()
wants to warn, the TYPE (in warnings.el terminology) is always
`display', and the LEVEL is `:error'.

If not all such calls should warn, or the LEVEL should sometimes be
other than :error, the change is simple (just add a couple args to
add_to_log), though someone will have to decide what to do in each
current instance (as I said, it's not hard, as there are only nine or
so).

As for the TYPE, it's easy to change it in each case, but then
filtering gets a bit more complex for little gain.

    Juanma



=== modified file 'lisp/subr.el'
--- lisp/subr.el        2012-01-23 02:10:36 +0000
+++ lisp/subr.el        2012-01-26 17:00:50 +0000
@@ -1879,7 +1879,37 @@
         (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 ((errors nil)
+        (pending display-errors-pending))
+    (dolist (warning delayed-warnings-list)
+      (when (eq (car warning) 'display)
+        (push warning errors)))
+    (when errors
+      (setq delayed-warnings-list (assq-delete-all 'display
+                                                   delayed-warnings-list))
+      (setq display-errors-pending (nconc display-errors-pending errors))
+      (unless pending
+        (run-with-idle-timer display-errors-idle-time nil
+                             (lambda ()
+                               ;; Already sorted, no need to reverse
+                               (dolist (warning display-errors-pending)
+                                 (apply 'display-warning warning))
+                               (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/xdisp.c'
--- src/xdisp.c 2012-01-19 07:21:25 +0000
+++ src/xdisp.c 2012-01-26 16:42:45 +0000
@@ -9069,6 +9069,12 @@
   message_dolog (buffer, len - 1, 1, 0);
   SAFE_FREE ();

+  args[0] = Qdisplay;
+  args[1] = msg;
+  args[2] = Qerror;
+  Vdelayed_warnings_list = Fcons (Flist (3, args),
+                                  Vdelayed_warnings_list);
+
   UNGCPRO;
 }





reply via email to

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