GNU bug report logs - #416
flymake highlights errors from wrong file

Previous Next

Package: emacs;

Reported by: Nikolaj Schumacher <n_schumacher <at> web.de>

Date: Sun, 15 Jun 2008 16:35:03 UTC

Severity: normal

Done: Chong Yidong <cyd <at> stupidchicken.com>

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 416 in the body.
You can then email your comments to 416 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#416; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Nikolaj Schumacher <n_schumacher <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: Nikolaj Schumacher <n_schumacher <at> web.de>
To: bug-gnu-emacs <at> gnu.org
Subject: flymake highlights errors from wrong file
Date: Sun, 15 Jun 2008 18:27:37 +0200
[Message part 1 (text/plain, inline)]
Hello.

flymake will highlight errors in the current buffer, even if the error
comes from a different file.

This can be noted, for example, when using

>  check-syntax:
>          gcc -Wall -Wextra -fsyntax-only *.cpp

instead of the more common

>  check-syntax:
>          gcc -Wall -Wextra -pedantic -fsyntax-only -S $(CHK_SOURCES)

in the Makefile.

It also happens when using ant, where it can't be avoided.


The attached patch filters out these errors when parsing.
Alternatively, they could be filtered out when highlighting.


regards,
Nikolaj Schumacher

[emacs-flymake-other-files.patch (text/x-patch, inline)]
diff -du /Users/nik/emacs/var/backup/\!Applications\!Emacs.app\!Contents\!Resources\!share\!emacs\!22.2\!lisp\!progmodes\!flymake.el.\~2\~ /Applications/Emacs.app/Contents/Resources/share/emacs/22.2/lisp/progmodes/flymake.el
--- lisp/progmodes/flymake.el	2008-06-02 23:30:29.000000000 +0200
+++ lisp/progmodes/flymake.el	2008-06-05 23:30:08.000000000 +0200
@@ -866,11 +867,10 @@
                                       (flymake-ler-file line-err-info)))
 	(setq line-err-info (flymake-ler-set-full-file line-err-info real-file-name))
 
-	(if (flymake-same-files real-file-name source-file-name)
-	    (setq line-err-info (flymake-ler-set-file line-err-info nil))
-	  (setq line-err-info (flymake-ler-set-file line-err-info (file-name-nondirectory real-file-name))))
+	(when (flymake-same-files real-file-name source-file-name)
+	  (setq line-err-info (flymake-ler-set-file line-err-info nil))
+	  (setq err-info-list (flymake-add-err-info err-info-list line-err-info))))
 
-	(setq err-info-list (flymake-add-err-info err-info-list line-err-info)))
       (flymake-log 3 "parsed '%s', %s line-err-info" (nth idx lines) (if line-err-info "got" "no"))
       (setq idx (1+ idx)))
     err-info-list))

Diff finished.  Thu Jun  5 23:30:18 2008

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

Acknowledgement sent to Chong Yidong <cyd <at> stupidchicken.com>:
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 416 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Chong Yidong <cyd <at> stupidchicken.com>
To: Pavel Kobyakov <pk_at_work <at> yahoo.com>
Cc: Nikolaj Schumacher <n_schumacher <at> web.de>, 416 <at> debbugs.gnu.org
Subject: Re: flymake highlights errors from wrong file
Date: Mon, 18 Aug 2008 15:21:39 -0400
Hi Pavel,

Could you review the patch sent by Nikolaj?  Thanks.

Nikolaj Schumacher wrote:

> flymake will highlight errors in the current buffer, even if the error
> comes from a different file.
>
> This can be noted, for example, when using
>
> >  check-syntax:
> >          gcc -Wall -Wextra -fsyntax-only *.cpp
>
> instead of the more common
>
> >  check-syntax:
> >          gcc -Wall -Wextra -pedantic -fsyntax-only -S $(CHK_SOURCES)
>
> in the Makefile.
>
> It also happens when using ant, where it can't be avoided.
>
> The attached patch filters out these errors when parsing.
> Alternatively, they could be filtered out when highlighting.

--- lisp/progmodes/flymake.el	2008-06-02 23:30:29.000000000 +0200
+++ lisp/progmodes/flymake.el	2008-06-05 23:30:08.000000000 +0200
@@ -866,11 +867,10 @@
                                       (flymake-ler-file line-err-info)))
 	(setq line-err-info (flymake-ler-set-full-file line-err-info real-file-name))
 
-	(if (flymake-same-files real-file-name source-file-name)
-	    (setq line-err-info (flymake-ler-set-file line-err-info nil))
-	  (setq line-err-info (flymake-ler-set-file line-err-info (file-name-nondirectory real-file-name))))
+	(when (flymake-same-files real-file-name source-file-name)
+	  (setq line-err-info (flymake-ler-set-file line-err-info nil))
+	  (setq err-info-list (flymake-add-err-info err-info-list line-err-info))))
 
-	(setq err-info-list (flymake-add-err-info err-info-list line-err-info)))
       (flymake-log 3 "parsed '%s', %s line-err-info" (nth idx lines) (if line-err-info "got" "no"))
       (setq idx (1+ idx)))
     err-info-list))





bug closed, send any further explanations to Nikolaj Schumacher <n_schumacher <at> web.de> Request was from Chong Yidong <cyd <at> stupidchicken.com> to control <at> emacsbugs.donarmstrong.com. (Sun, 07 Sep 2008 19:15:04 GMT) Full text and rfc822 format available.

Message #13 received at 416-done <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Chong Yidong <cyd <at> stupidchicken.com>
To: Nikolaj Schumacher <n_schumacher <at> web.de>
Cc: 416-done <at> debbugs.gnu.org
Subject: Re: flymake highlights errors from wrong file
Date: Sun, 07 Sep 2008 15:08:57 -0400
> flymake will highlight errors in the current buffer, even if the error
> comes from a different file.
>
> The attached patch filters out these errors when parsing.
> Alternatively, they could be filtered out when highlighting.

I've checked your patch into CVS.  Thanks.




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

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

Previous Next


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