GNU bug report logs - #34479
Incorrect classification of messages in compilation-mode buffer

Previous Next

Package: emacs;

Reported by: Daniel Lopez <daniel.lopez999 <at> gmail.com>

Date: Thu, 14 Feb 2019 16:03:01 UTC

Severity: normal

Tags: patch

Done: Eli Zaretskii <eliz <at> gnu.org>

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 34479 in the body.
You can then email your comments to 34479 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-gnu-emacs <at> gnu.org:
bug#34479; Package emacs. (Thu, 14 Feb 2019 16:03:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Daniel Lopez <daniel.lopez999 <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 14 Feb 2019 16:03:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Daniel Lopez <daniel.lopez999 <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Incorrect classification of messages in compilation-mode buffer
Date: Thu, 14 Feb 2019 16:00:08 +0000
[Message part 1 (text/plain, inline)]
Reproduce:

- Open the attached test program compilation_test.c in Emacs
- M-x compile
- Enter compile command "gcc -c compilation_test.c"

In the resulting *compilation* buffer, there should be a mixture of 
"error", "warning" and "note" messages. Trouble is they're all parsed as 
errors - hence they're all coloured in red, and querying any one's type 
by moving point onto it and evaluating "(compilation--message->type 
(get-text-property (point) 'compilation-message))" always returns 2, 
though warnings should return 1 and notes should return 0. Commands that 
jump between previous/next error also behave correspondingly wrongly.

Fix:

The attached fix_compilation_message_type.patch, applied to Git master, 
fixes it for me.

It seems like the old code was accidentally using the same variable for 
the TYPE field of the current rule from compilation-error-regexp-alist, 
and in an inner loop, the actual type that the current message from the 
compilation buffer was resolved to be, so the resolved type of the first 
message tends to get carried down into the following ones.

Daniel
[compilation_test.c (text/x-csrc, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#34479; Package emacs. (Thu, 14 Feb 2019 16:08:02 GMT) Full text and rfc822 format available.

Message #8 received at 34479 <at> debbugs.gnu.org (full text, mbox):

From: Daniel Lopez <daniel.lopez999 <at> gmail.com>
To: 34479 <at> debbugs.gnu.org
Subject: Incorrect classification of messages in compilation-mode buffer
Date: Thu, 14 Feb 2019 16:05:10 +0000
[Message part 1 (text/plain, inline)]
Argh, I forgot to attach the patch. Here it is!

Daniel
[fix_compilation_message_type.patch (text/x-patch, attachment)]

Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Fri, 15 Feb 2019 08:03:02 GMT) Full text and rfc822 format available.

Notification sent to Daniel Lopez <daniel.lopez999 <at> gmail.com>:
bug acknowledged by developer. (Fri, 15 Feb 2019 08:03:02 GMT) Full text and rfc822 format available.

Message #13 received at 34479-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Daniel Lopez <daniel.lopez999 <at> gmail.com>
Cc: 34479-done <at> debbugs.gnu.org
Subject: Re: bug#34479: Incorrect classification of messages in
 compilation-mode buffer
Date: Fri, 15 Feb 2019 10:02:19 +0200
> From: Daniel Lopez <daniel.lopez999 <at> gmail.com>
> Date: Thu, 14 Feb 2019 16:05:10 +0000
> 
> Argh, I forgot to attach the patch. Here it is!

Thanks.  This is a relatively recent regression, so I pushed it to the
emacs-26 branch.

Please in the future include a ChangeLog-style commit log message with
your patches.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#34479; Package emacs. (Mon, 25 Feb 2019 13:27:02 GMT) Full text and rfc822 format available.

Message #16 received at 34479 <at> debbugs.gnu.org (full text, mbox):

From: Tobias Bading <tbading <at> web.de>
To: 34479 <at> debbugs.gnu.org
Cc: Eli Zaretskii <eliz <at> gnu.org>, Daniel Lopez <daniel.lopez999 <at> gmail.com>
Subject: Re: bug#34479: Incorrect classification of messages in
 compilation-mode buffer
Date: Mon, 25 Feb 2019 14:26:38 +0100
I also discovered this bug a few days ago and came up with the same fix as Daniel. However, there’s a small mistake in his patch which results in incorrect error numbers in the mode line. The compilation--note-type call should look like this:

diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index 146af5a..368b088 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -1441,7 +1441,7 @@ compilation-parse-errors
               (let ((this-type (if (consp type)
                                    (compilation-type type)
                                  (or type 2))))
-                (compilation--note-type type)
+                (compilation--note-type this-type)
 
                 (compilation--put-prop
                  file 'font-lock-face

Regards,
Tobias





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#34479; Package emacs. (Mon, 25 Feb 2019 16:07:02 GMT) Full text and rfc822 format available.

Message #19 received at 34479 <at> debbugs.gnu.org (full text, mbox):

From: Daniel Lopez <daniel.lopez999 <at> gmail.com>
To: Tobias Bading <tbading <at> web.de>, 34479 <at> debbugs.gnu.org
Cc: Eli Zaretskii <eliz <at> gnu.org>
Subject: Re: bug#34479: Incorrect classification of messages in
 compilation-mode buffer
Date: Mon, 25 Feb 2019 16:03:58 +0000
> diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
> index 146af5a..368b088 100644
> --- a/lisp/progmodes/compile.el
> +++ b/lisp/progmodes/compile.el
> @@ -1441,7 +1441,7 @@ compilation-parse-errors
>                 (let ((this-type (if (consp type)
>                                      (compilation-type type)
>                                    (or type 2))))
> -                (compilation--note-type type)
> +                (compilation--note-type this-type)
>
>                   (compilation--put-prop
>                    file 'font-lock-face

Hi Tobias,

Just verified it here - I agree, that should be changed as well.

(In fact, the copy of the function that's currently in my init file to
replace the original just for now, already has that extra change. Not
sure why that didn't make it into my original patch. Thanks for spotting.)

Daniel




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#34479; Package emacs. (Fri, 01 Mar 2019 10:08:01 GMT) Full text and rfc822 format available.

Message #22 received at 34479 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Tobias Bading <tbading <at> web.de>
Cc: daniel.lopez999 <at> gmail.com, 34479 <at> debbugs.gnu.org
Subject: Re: bug#34479: Incorrect classification of messages in
 compilation-mode buffer
Date: Fri, 01 Mar 2019 12:07:24 +0200
> From: Tobias Bading <tbading <at> web.de>
> Date: Mon, 25 Feb 2019 14:26:38 +0100
> Cc: Daniel Lopez <daniel.lopez999 <at> gmail.com>,
>  Eli Zaretskii <eliz <at> gnu.org>
> 
> I also discovered this bug a few days ago and came up with the same fix as Daniel. However, there’s a small mistake in his patch which results in incorrect error numbers in the mode line. The compilation--note-type call should look like this:
> 
> diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
> index 146af5a..368b088 100644
> --- a/lisp/progmodes/compile.el
> +++ b/lisp/progmodes/compile.el
> @@ -1441,7 +1441,7 @@ compilation-parse-errors
>                (let ((this-type (if (consp type)
>                                     (compilation-type type)
>                                   (or type 2))))
> -                (compilation--note-type type)
> +                (compilation--note-type this-type)
>  
>                  (compilation--put-prop
>                   file 'font-lock-face

Thanks, pushed to the emacs-26 branch.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 29 Mar 2019 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 6 years and 85 days ago.

Previous Next


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