Function: collapse-delayed-warnings

collapse-delayed-warnings is a byte-compiled function defined in subr.el.gz.

Signature

(collapse-delayed-warnings)

Documentation

Remove duplicates from delayed-warnings-list.

Collapse identical adjacent warnings into one (plus count). Used from delayed-warnings-hook (which see).

Probably introduced at or before Emacs version 24.1.

Source Code

;; Defined in /usr/src/emacs/lisp/subr.el.gz
(defun collapse-delayed-warnings ()
  "Remove duplicates from `delayed-warnings-list'.
Collapse identical adjacent warnings into one (plus count).
Used from `delayed-warnings-hook' (which see)."
  (let ((count 1)
        collapsed warning)
    (while delayed-warnings-list
      (setq warning (pop delayed-warnings-list))
      (if (equal warning (car delayed-warnings-list))
          (setq count (1+ count))
        (when (> count 1)
          (setcdr warning (cons (format "%s [%d times]" (cadr warning) count)
                                (cddr warning)))
          (setq count 1))
        (push warning collapsed)))
    (setq delayed-warnings-list (nreverse collapsed))))