From unknown Sun Aug 17 22:09:54 2025 X-Loop: don@donarmstrong.com Subject: bug#416: flymake highlights errors from wrong file Reply-To: Nikolaj Schumacher , 416@debbugs.gnu.org Resent-From: Nikolaj Schumacher Original-Sender: n_schumacher@web.de Resent-To: bug-submit-list@lists.donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Sun, 15 Jun 2008 16:35:03 +0000 Resent-Message-ID: Resent-Sender: don@donarmstrong.com X-Emacs-PR-Message: report 416 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Received: via spool by submit@emacsbugs.donarmstrong.com id=B.121354727317286 (code B ref -1); Sun, 15 Jun 2008 16:35:03 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02 (2007-08-08) on rzlab.ucr.edu X-Spam-Level: X-Spam-Status: No, score=-5.0 required=4.0 tests=BAYES_00,MURPHY_DRUGS_REL8, RCVD_IN_DNSWL_LOW autolearn=ham version=3.2.3-bugs.debian.org_2005_01_02 Received: (at submit) by emacsbugs.donarmstrong.com; 15 Jun 2008 16:27:53 +0000 Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m5FGRlFi017280 for ; Sun, 15 Jun 2008 09:27:48 -0700 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1K7v50-0003G7-QC for bug-gnu-emacs@gnu.org; Sun, 15 Jun 2008 12:27:46 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1K7v4y-0003Cq-Na for bug-gnu-emacs@gnu.org; Sun, 15 Jun 2008 12:27:46 -0400 Received: from [199.232.76.173] (port=39883 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K7v4y-0003CW-J2 for bug-gnu-emacs@gnu.org; Sun, 15 Jun 2008 12:27:44 -0400 Received: from fmmailgate03.web.de ([217.72.192.234]:34727) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1K7v4y-0002Xi-8B for bug-gnu-emacs@gnu.org; Sun, 15 Jun 2008 12:27:44 -0400 Received: from smtp06.web.de (fmsmtp06.dlan.cinetic.de [172.20.5.172]) by fmmailgate03.web.de (Postfix) with ESMTP id D56BADFE854B for ; Sun, 15 Jun 2008 18:27:38 +0200 (CEST) Received: from [77.189.9.128] (helo=thursday) by smtp06.web.de with asmtp (WEB.DE 4.109 #226) id 1K7v4s-0001vQ-00 for bug-gnu-emacs@gnu.org; Sun, 15 Jun 2008 18:27:38 +0200 To: bug-gnu-emacs@gnu.org From: Nikolaj Schumacher User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (darwin) Date: Sun, 15 Jun 2008 18:27:37 +0200 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Sender: n_schumacher@web.de X-Sender: n_schumacher@web.de X-Provags-ID: V01U2FsdGVkX1/5RsjKHp9fTIJuUUAAcYOO8WF7a8HwGXJfLSu9 2tz78pzQFXTqO+vFauB03uSce0Y4janud0nuePieaHzvY3ftcE aGUl1CPlbSm4FvAlDDoA== X-detected-kernel: by monty-python.gnu.org: Linux 2.4-2.6 --=-=-= 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 --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=emacs-flymake-other-files.patch Content-Description: patch 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 --=-=-=-- From unknown Sun Aug 17 22:09:54 2025 X-Loop: don@donarmstrong.com Subject: bug#416: flymake highlights errors from wrong file Reply-To: Chong Yidong , 416@debbugs.gnu.org Resent-From: Chong Yidong Resent-To: bug-submit-list@lists.donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Mon, 18 Aug 2008 19:30:03 +0000 Resent-Message-ID: Resent-Sender: don@donarmstrong.com X-Emacs-PR-Message: report 416 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Received: via spool by 416-submit@emacsbugs.donarmstrong.com id=B416.12190872457934 (code B ref 416); Mon, 18 Aug 2008 19:30:03 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02 (2007-08-08) on rzlab.ucr.edu X-Spam-Level: X-Spam-Status: No, score=-3.5 required=4.0 tests=AWL,BAYES_00, MURPHY_DRUGS_REL8 autolearn=ham version=3.2.3-bugs.debian.org_2005_01_02 Received: (at 416) by emacsbugs.donarmstrong.com; 18 Aug 2008 19:20:45 +0000 Received: from cyd.mit.edu (CYD.MIT.EDU [18.115.2.24]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m7IJKb18007928 for <416@emacsbugs.donarmstrong.com>; Mon, 18 Aug 2008 12:20:38 -0700 Received: by cyd.mit.edu (Postfix, from userid 1000) id 714AB57E1C6; Mon, 18 Aug 2008 15:21:39 -0400 (EDT) From: Chong Yidong To: Pavel Kobyakov Cc: Nikolaj Schumacher , 416@debbugs.gnu.org Date: Mon, 18 Aug 2008 15:21:39 -0400 Message-ID: <874p5ijfi4.fsf@cyd.mit.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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))