From d1a5c3b45081c237658c6f6b74bbd6bc986acb60 Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Mon, 23 Jan 2012 02:10:50 +0100 Subject: [PATCH] lisp/subr.el (display-delayed-warnings): Collapse identical adjacent messages. --- lisp/ChangeLog | 5 +++++ lisp/subr.el | 15 +++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 8ada003d23d..ff2b4b5f226 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2012-01-23 Juanma Barranquero + + * subr.el (display-delayed-warnings): + Collapse identical adjacent messages. + 2012-01-22 Michael Albinus * net/tramp.el (tramp-action-login): Set connection property "login-as". diff --git a/lisp/subr.el b/lisp/subr.el index 14f9192405c..da11b7e982a 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -1857,9 +1857,20 @@ FILE should be the name of a library, with no directory name." (defun display-delayed-warnings () "Display delayed warnings from `delayed-warnings-list'. +Collapse identical adjacent messages into one (plus count). This is the default value of `delayed-warnings-hook'." - (dolist (warning (nreverse delayed-warnings-list)) - (apply 'display-warning warning)) + (let ((count 1) + (warnings (nreverse delayed-warnings-list)) + warning) + (while warnings + (setq warning (pop warnings)) + (if (equal warning (car warnings)) + (setq count (1+ count)) + (when (> count 1) + (setcdr warning (cons (format "%s [%d times]" (cadr warning) count) + (cddr warning))) + (setq count 1)) + (apply 'display-warning warning)))) (setq delayed-warnings-list nil)) (defvar delayed-warnings-hook '(display-delayed-warnings) -- 2.39.2