unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juanma Barranquero <lekktu@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: larsi@gnus.org, 10578@debbugs.gnu.org
Subject: bug#10578: 24.0.92; No png images on OpenSUSE 12.1
Date: Thu, 26 Jan 2012 18:22:21 +0100	[thread overview]
Message-ID: <CAAeL0SScwGDXZBX+h=KBj_hLHcVV6grf+1A9eLUT13r2evne1Q@mail.gmail.com> (raw)
In-Reply-To: <E1RqPe4-0005gp-6O@fencepost.gnu.org>

On Thu, Jan 26, 2012 at 14:45, Eli Zaretskii <eliz@gnu.org> 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;
 }





  parent reply	other threads:[~2012-01-26 17:22 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
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 [this message]
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='CAAeL0SScwGDXZBX+h=KBj_hLHcVV6grf+1A9eLUT13r2evne1Q@mail.gmail.com' \
    --to=lekktu@gmail.com \
    --cc=10578@debbugs.gnu.org \
    --cc=eliz@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).