Subject: Re: bug#931: 23.0.60; Bug in bytecomp.el: displaying warnings

From: Stefan Monnier <[email-masked]>
Date: Tue, 09 Sep 2008 10:33:37 -0400

> If pop-up-windows is nil, and warnings have to be displayed,
> `byte-compile-report-error' is called, and after that,
> (current-buffer) will be the Compile Log buffer, and the current
> buffer is not restored for further iterations of the while loop.

Does the patch below fix the problem?
Maybe the fix should even be pushed further down into display-buffer?

        Stefan

=== modified file 'lisp/emacs-lisp/warnings.el'
--- lisp/emacs-lisp/warnings.el	2008-05-06 14:18:59 +0000
+++ lisp/emacs-lisp/warnings.el	2008-09-09 14:32:38 +0000
@@ -286,11 +286,15 @@
 	  (or (< (warning-numeric-level level)
 		 (warning-numeric-level warning-minimum-level))
 	      (warning-suppress-p type warning-suppress-types)
+              ;; `display-buffer' usually preserves current-buffer, except
+              ;; when it ends up doing switch-to-buffer (e.g. pop-up-windows
+              ;; is nil).
+              (save-current-buffer
 	      (let ((window (display-buffer buffer)))
 		(when (and (markerp warning-series)
 			   (eq (marker-buffer warning-series) buffer))
 		  (set-window-start window warning-series))
-		(sit-for 0)))))))
+                  (sit-for 0))))))))
 
 ;;;###autoload
 (defun lwarn (type level message &rest args)