GNU bug report logs - #931
23.0.60; Bug in bytecomp.el: displaying warnings

Previous Next

Package: emacs;

Reported by: michael_heerdegen <at> web.de

Date: Mon, 8 Sep 2008 19:45:03 UTC

Severity: normal

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 931 in the body.
You can then email your comments to 931 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#931; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to michael_heerdegen <at> web.de:
New bug report received and forwarded. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: emacs-pretest-bug <at> gnu.org
Subject: 23.0.60; Bug in bytecomp.el: displaying warnings
Date: Mon, 8 Sep 2008 21:35:23 +0200
When pop-up-windows is nil, the byte compiler sometimes aborts with
the error message

  End of file during parsing

after displaying warnings, although the source file is ok.


You can reproduce this with CVS Gnu Emacs as follows:

1. Create a file test.el with the following contents:

    (setq a 1)

2. emacs -Q

3. M-: (setq pop-up-windows nil) RET

4. Byte compile test.el


The reason for the bug is an error in `byte-compile-from-buffer'. Its
definition looks like that:

(defun byte-compile-from-buffer (inbuffer &optional filename)
  ...
  (let ...
    (byte-compile-close-variables
     ...
     (displaying-byte-compile-warnings
      ...
      (with-current-buffer inbuffer
        ...
	(while ...
	 ...)
        ...)
      ...))
    ...))

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.







Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#931; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to martin rudalics <rudalics <at> gmx.at>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #10 received at 931 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: 931 <at> debbugs.gnu.org
Cc: michael_heerdegen <at> web.de
Subject: Re: bug#931: 23.0.60; Bug in bytecomp.el: displaying warnings
Date: Mon, 08 Sep 2008 23:12:35 +0200
> 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.

I suppose the byte-compiler should either refrain from using
`display-warning' or, if `pop-up-windows' and `pop-up-frames' are nil,
not display a warning until compilation is complete.

martin




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#931; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to rms <at> gnu.org:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #15 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: "Richard M. Stallman" <rms <at> gnu.org>
To: martin rudalics <rudalics <at> gmx.at>, 931 <at> debbugs.gnu.org
Cc: 931 <at> debbugs.gnu.org, bug-submit-list <at> donarmstrong.com,
        michael_heerdegen <at> web.de, bug-gnu-emacs <at> gnu.org
Subject: Re: bug#931: 23.0.60; Bug in bytecomp.el: displaying warnings
Date: Tue, 09 Sep 2008 04:11:33 -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.

    I suppose the byte-compiler should either refrain from using
    `display-warning'

That would be very drastic and cause a lot of inconvenience
in the normal situation where there is no bug!

		      or, if `pop-up-windows' and `pop-up-frames' are nil,
    not display a warning until compilation is complete.

The solution that occurs to me is that `display-warning' should
bind `pop-up-windows' to t in that case.





Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#931; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to rms <at> gnu.org:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#931; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #25 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: michael_heerdegen <at> web.de
Cc: 931 <at> debbugs.gnu.org, emacs-pretest-bug <at> gnu.org
Subject: Re: bug#931: 23.0.60; Bug in bytecomp.el: displaying warnings
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)





Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#931; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#931; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to martin rudalics <rudalics <at> gmx.at>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #35 received at 931 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: rms <at> gnu.org
Cc: 931 <at> debbugs.gnu.org, michael_heerdegen <at> web.de
Subject: Re: bug#931: 23.0.60; Bug in bytecomp.el: displaying warnings
Date: Wed, 10 Sep 2008 11:23:12 +0200
>     I suppose the byte-compiler should either refrain from using
>     `display-warning'
>
> That would be very drastic and cause a lot of inconvenience
> in the normal situation where there is no bug!

I obviously meant use something different instead of `display-warning'.

> 		      or, if `pop-up-windows' and `pop-up-frames' are nil,
>     not display a warning until compilation is complete.
>
> The solution that occurs to me is that `display-warning' should
> bind `pop-up-windows' to t in that case.

This would (1) ignore a user preference and (2) not work when the window
can't be split for some reason.

martin





Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#931; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to martin rudalics <rudalics <at> gmx.at>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #40 received at 931 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>, 931 <at> debbugs.gnu.org
Cc: michael_heerdegen <at> web.de
Subject: Re: bug#931: 23.0.60; Bug in bytecomp.el: displaying warnings
Date: Wed, 10 Sep 2008 11:23:43 +0200
> +              ;; `display-buffer' usually preserves current-buffer, except
> +              ;; when it ends up doing switch-to-buffer (e.g. pop-up-windows
> +              ;; is nil).

FWIW it's set_window_buffer in

  /* We must select BUFFER for running the window-scroll-functions.
     If WINDOW is selected, switch permanently.
     Otherwise, switch but go back to the ambient buffer afterward.  */
  if (EQ (window, selected_window))
    Fset_buffer (buffer);

which is not very clean (and not documented in `set-window-buffer').

> +              (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))))))))

This will cause the *Warnings* buffer to flash shortly here and
immediately get replaced when compilation finished.

martin





Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#931; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #45 received at 931 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 931 <at> debbugs.gnu.org, michael_heerdegen <at> web.de
Subject: Re: bug#931: 23.0.60; Bug in bytecomp.el: displaying warnings
Date: Wed, 10 Sep 2008 12:24:54 -0400
>> +              (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))))))))

> This will cause the *Warnings* buffer to flash shortly here and
> immediately get replaced when compilation finished.

Are you sure?  save-current-buffer does not mess with selected windows,
so it should have no such effect.


        Stefan




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#931; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to martin rudalics <rudalics <at> gmx.at>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #50 received at 931 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 931 <at> debbugs.gnu.org, michael_heerdegen <at> web.de
Subject: Re: bug#931: 23.0.60; Bug in bytecomp.el: displaying warnings
Date: Wed, 10 Sep 2008 19:37:16 +0200
>> This will cause the *Warnings* buffer to flash shortly here and
>> immediately get replaced when compilation finished.
>
> Are you sure?  save-current-buffer does not mess with selected windows,
> so it should have no such effect.

The *Warnings* buffer is displayed for less than a second and gets
replaced by the buffer I compile.  Did you mean the *Warnings* buffer
would stay in the selected window after compilation finishes?  That
would mean that `display-buffer' messed with the selected window.

martin




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#931; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to rms <at> gnu.org:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #55 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: "Richard M. Stallman" <rms <at> gnu.org>
To: martin rudalics <rudalics <at> gmx.at>, 931 <at> debbugs.gnu.org
Cc: bug-submit-list <at> donarmstrong.com, 931 <at> debbugs.gnu.org,
        michael_heerdegen <at> web.de, bug-gnu-emacs <at> gnu.org
Subject: Re: bug#931: 23.0.60; Bug in bytecomp.el: displaying warnings
Date: Wed, 10 Sep 2008 16:46:46 -0400
     >     I suppose the byte-compiler should either refrain from using
     >     `display-warning'
     >
     > That would be very drastic and cause a lot of inconvenience
     > in the normal situation where there is no bug!

    I obviously meant use something different instead of `display-warning'.

`display-warning' was made for uses like this.  If what it does now is
not right in some circumstances, we should change it to do something
better.  Whatever is the right thing to do for these messages,
`display-warning' should do it.

     > The solution that occurs to me is that `display-warning' should
     > bind `pop-up-windows' to t in that case.

    This would (1) ignore a user preference

That is a general preference.  There is no need to be rigid about it
in a special case where it leads to clearly undesirable behavior.

					    and (2) not work when the window
    can't be split for some reason.

That is true.  Fortunately such cases are rare.  `display-warning'
could do something special for those cases.  Perhaps just mention in
the echo area that there are warnings.





Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#931; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to rms <at> gnu.org:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#931; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #65 received at 931 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 931 <at> debbugs.gnu.org, michael_heerdegen <at> web.de
Subject: Re: bug#931: 23.0.60; Bug in bytecomp.el: displaying warnings
Date: Wed, 10 Sep 2008 21:52:42 -0400
>>> This will cause the *Warnings* buffer to flash shortly here and
>>> immediately get replaced when compilation finished.
>> Are you sure?  save-current-buffer does not mess with selected windows,
>> so it should have no such effect.
> The *Warnings* buffer is displayed for less than a second and gets
> replaced by the buffer I compile.

OK.  But it does fix the OP's problem (that the compilation fails with
an error), right?


        Stefan




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#931; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to martin rudalics <rudalics <at> gmx.at>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #70 received at 931 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: rms <at> gnu.org
Cc: 931 <at> debbugs.gnu.org, michael_heerdegen <at> web.de
Subject: Re: bug#931: 23.0.60; Bug in bytecomp.el: displaying warnings
Date: Thu, 11 Sep 2008 10:53:36 +0200
> `display-warning' was made for uses like this.  If what it does now is
> not right in some circumstances, we should change it to do something
> better.  Whatever is the right thing to do for these messages,
> `display-warning' should do it.

We could do something special if `warning-series' is non-nil.  Or maybe
`displaying-byte-compile-warnings' could do that.

martin





Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#931; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to martin rudalics <rudalics <at> gmx.at>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #75 received at 931 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 931 <at> debbugs.gnu.org, michael_heerdegen <at> web.de
Subject: Re: bug#931: 23.0.60; Bug in bytecomp.el: displaying warnings
Date: Thu, 11 Sep 2008 10:53:24 +0200
> OK.  But it does fix the OP's problem (that the compilation fails with
> an error), right?

Sure ;-)

martin






Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#931; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #80 received at 931 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 931 <at> debbugs.gnu.org, michael_heerdegen <at> web.de
Subject: Re: bug#931: 23.0.60; Bug in bytecomp.el: displaying warnings
Date: Fri, 12 Sep 2008 12:30:20 -0400
>> +              ;; `display-buffer' usually preserves current-buffer, except
>> +              ;; when it ends up doing switch-to-buffer (e.g. pop-up-windows
>> +              ;; is nil).

> FWIW it's set_window_buffer in

>   /* We must select BUFFER for running the window-scroll-functions.
>      If WINDOW is selected, switch permanently.
>      Otherwise, switch but go back to the ambient buffer afterward.  */
>   if (EQ (window, selected_window))
>     Fset_buffer (buffer);

> which is not very clean (and not documented in `set-window-buffer').

I've fixed this so set-window-buffer should never change
current-buffer now.  Does it fix the OP's original problem?


        Stefan




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#931; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to martin rudalics <rudalics <at> gmx.at>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #85 received at 931 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 931 <at> debbugs.gnu.org, michael_heerdegen <at> web.de
Subject: Re: bug#931: 23.0.60; Bug in bytecomp.el: displaying warnings
Date: Fri, 12 Sep 2008 20:04:59 +0200
> I've fixed this so set-window-buffer should never change
> current-buffer now.  Does it fix the OP's original problem?

Keeping my fingers still crossed for that change, so I can't type much
today ;-)

FWIW it fixes the original problem but we should show *Compile-Log*
instead of the original buffer when compilation finishes.  As I
suggested earlier `displaying-byte-compile-warnings' could do that when
`pop-up-windows' is nil (maybe only if a critical bug has been found).
This could be a wishlist item.

martin





Reply sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
You have taken responsibility. Full text and rfc822 format available.

Notification sent to michael_heerdegen <at> web.de:
bug acknowledged by developer. Full text and rfc822 format available.

Message #90 received at 931-close <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 931-close <at> debbugs.gnu.org, michael_heerdegen <at> web.de
Subject: Re: bug#931: 23.0.60; Bug in bytecomp.el: displaying warnings
Date: Fri, 12 Sep 2008 15:51:59 -0400
>> I've fixed this so set-window-buffer should never change
>> current-buffer now.  Does it fix the OP's original problem?
> Keeping my fingers still crossed for that change, so I can't type much
> today ;-)

> FWIW it fixes the original problem

Good, thanks.

> but we should show *Compile-Log* instead of the original buffer when
> compilation finishes.

That's a separate problem.  And I'm not even sure if that's really what
should happen anyway.

> This could be a wishlist item.

Indeed.


        Stefan




bug archived. Request was from Debbugs Internal Request <don <at> donarmstrong.com> to internal_control <at> emacsbugs.donarmstrong.com. (Sat, 11 Oct 2008 14:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 16 years and 310 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.