diff options
| author | Joakim Verona | 2012-01-23 15:10:06 +0100 |
|---|---|---|
| committer | Joakim Verona | 2012-01-23 15:10:06 +0100 |
| commit | 0322b140eead7c94de7f0f6d19a90bd15690b4eb (patch) | |
| tree | 950c011783cc896d0450084cb5155e54548bfe5b /lisp/subr.el | |
| parent | d5114bfea3ea4c37c57e2af0f3b095be9fcd8bac (diff) | |
| parent | cb5850f27c1b4d26957d58e2da2314dd12498671 (diff) | |
| download | emacs-0322b140eead7c94de7f0f6d19a90bd15690b4eb.tar.gz emacs-0322b140eead7c94de7f0f6d19a90bd15690b4eb.zip | |
upstream
Diffstat (limited to 'lisp/subr.el')
| -rw-r--r-- | lisp/subr.el | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/lisp/subr.el b/lisp/subr.el index 14f9192405c..c9e213c86a0 100644 --- a/lisp/subr.el +++ b/lisp/subr.el | |||
| @@ -1857,12 +1857,30 @@ FILE should be the name of a library, with no directory name." | |||
| 1857 | 1857 | ||
| 1858 | (defun display-delayed-warnings () | 1858 | (defun display-delayed-warnings () |
| 1859 | "Display delayed warnings from `delayed-warnings-list'. | 1859 | "Display delayed warnings from `delayed-warnings-list'. |
| 1860 | This is the default value of `delayed-warnings-hook'." | 1860 | Used from `delayed-warnings-hook' (which see)." |
| 1861 | (dolist (warning (nreverse delayed-warnings-list)) | 1861 | (dolist (warning (nreverse delayed-warnings-list)) |
| 1862 | (apply 'display-warning warning)) | 1862 | (apply 'display-warning warning)) |
| 1863 | (setq delayed-warnings-list nil)) | 1863 | (setq delayed-warnings-list nil)) |
| 1864 | 1864 | ||
| 1865 | (defvar delayed-warnings-hook '(display-delayed-warnings) | 1865 | (defun collapse-delayed-warnings () |
| 1866 | "Remove duplicates from `delayed-warnings-list'. | ||
| 1867 | Collapse identical adjacent warnings into one (plus count). | ||
| 1868 | Used from `delayed-warnings-hook' (which see)." | ||
| 1869 | (let ((count 1) | ||
| 1870 | collapsed warning) | ||
| 1871 | (while delayed-warnings-list | ||
| 1872 | (setq warning (pop delayed-warnings-list)) | ||
| 1873 | (if (equal warning (car delayed-warnings-list)) | ||
| 1874 | (setq count (1+ count)) | ||
| 1875 | (when (> count 1) | ||
| 1876 | (setcdr warning (cons (format "%s [%d times]" (cadr warning) count) | ||
| 1877 | (cddr warning))) | ||
| 1878 | (setq count 1)) | ||
| 1879 | (push warning collapsed))) | ||
| 1880 | (setq delayed-warnings-list (nreverse collapsed)))) | ||
| 1881 | |||
| 1882 | (defvar delayed-warnings-hook '(collapse-delayed-warnings | ||
| 1883 | display-delayed-warnings) | ||
| 1866 | "Normal hook run to process delayed warnings. | 1884 | "Normal hook run to process delayed warnings. |
| 1867 | Functions in this hook should access the `delayed-warnings-list' | 1885 | Functions in this hook should access the `delayed-warnings-list' |
| 1868 | variable (which see) and remove from it the warnings they process.") | 1886 | variable (which see) and remove from it the warnings they process.") |