From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Bernd Paysan via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#37633: Column part interpreted wrong in compilation mode Date: Sat, 05 Oct 2019 13:12:34 +0200 Message-ID: <2282407.NbK4RY0fEn@daiyu> Reply-To: Bernd Paysan Mime-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart1635646.hbdS1Sl0bu"; micalg="pgp-sha256"; protocol="application/pgp-signature" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="127448"; mail-complaints-to="usenet@blaine.gmane.org" Cc: anton@mips.complang.tuwien.ac.at To: 37633@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Oct 05 17:45:13 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iGmF7-000Wzi-2H for geb-bug-gnu-emacs@m.gmane.org; Sat, 05 Oct 2019 17:45:13 +0200 Original-Received: from localhost ([::1]:57456 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iGmF5-00070o-Sa for geb-bug-gnu-emacs@m.gmane.org; Sat, 05 Oct 2019 11:45:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:46209) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iGmEy-00070Z-0S for bug-gnu-emacs@gnu.org; Sat, 05 Oct 2019 11:45:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iGmEw-0006yB-P3 for bug-gnu-emacs@gnu.org; Sat, 05 Oct 2019 11:45:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:36219) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iGmEw-0006y0-9p for bug-gnu-emacs@gnu.org; Sat, 05 Oct 2019 11:45:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iGmEw-0001E5-4m for bug-gnu-emacs@gnu.org; Sat, 05 Oct 2019 11:45:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Bernd Paysan Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 05 Oct 2019 15:45:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 37633 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.15702902814656 (code B ref -1); Sat, 05 Oct 2019 15:45:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 5 Oct 2019 15:44:41 +0000 Original-Received: from localhost ([127.0.0.1]:45038 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iGmEZ-0001Cy-7u for submit@debbugs.gnu.org; Sat, 05 Oct 2019 11:44:41 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:53318) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iGhzT-00037b-NH for submit@debbugs.gnu.org; Sat, 05 Oct 2019 07:12:48 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45233) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iGhzS-0004LD-5J for bug-gnu-emacs@gnu.org; Sat, 05 Oct 2019 07:12:47 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iGhzQ-0001yL-Nm for bug-gnu-emacs@gnu.org; Sat, 05 Oct 2019 07:12:45 -0400 Original-Received: from mail.net2o.de ([185.183.156.191]:38202) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iGhzQ-0001x5-7r for bug-gnu-emacs@gnu.org; Sat, 05 Oct 2019 07:12:44 -0400 Original-Received: from daiyu.localnet (200116b8262f8d00cce002de63b8a600.dip.versatel-1u1.de [IPv6:2001:16b8:262f:8d00:cce0:2de:63b8:a600]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (Client did not present a certificate) by mail.net2o.de (Postfix) with ESMTPSA id C7B14400A5; Sat, 5 Oct 2019 13:12:40 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=net2o.de; s=mail; t=1570273961; bh=rO1don6BNwwT6CzvwIsUooUbc29wvS8YWj+GflmtUP4=; h=From:To:Cc:Subject:Date:From; b=ALK8/KzGGmmVny0vGE8wnDiAhOvq1LGb/+Rhj6ukUGiRGNvrpHsWPwREW+LWHV1X0 S66/zvAtk1cxPkD59wMLV5IJC8AEGcLYX7LdX9Xs9yz5p6B6zkpaGhf0B7or4KFRLw wY9DNQeyaIU0SDXA+bWmNj2fnnvus1eWRtQ8AjA8= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Mailman-Approved-At: Sat, 05 Oct 2019 11:44:37 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:168381 Archived-At: --nextPart1635646.hbdS1Sl0bu Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="UTF-8" Compilers like gcc and others (e.g. gforth) output file:line:column on each= =20 error or warning. However, =E2=80=9Ccolumn=E2=80=9D here is really the byt= e offset into the=20 line (starting at 1). Problems arise when tabs and UTF-8 glyphs are involved, e.g. compile =2D--------------test.c--------------- void foo() { printf("test %i", b); printf("test=E4=BD=A0=E5=A5=BD %i", c); } =2D--------------gcc test.c--------------- =2D*- mode: compilation; default-directory: "~/tmp/" -*- Compilation started at Sat Oct 5 12:13:23 gcc test.c test.c: In function =E2=80=98foo=E2=80=99: test.c:2:2: warning: implicit declaration of function =E2=80=98printf=E2=80= =99 [-Wimplicit- function-declaration] 2 | printf("test %i", b); | ^~~~~~ test.c:2:2: warning: incompatible implicit declaration of built-in function= =20 =E2=80=98printf=E2=80=99 test.c:1:1: note: include =E2=80=98=E2=80=99 or provide a declarat= ion of =E2=80=98printf=E2=80=99 +++ |+#include 1 | void foo() { test.c:2:20: error: =E2=80=98b=E2=80=99 undeclared (first use in this funct= ion) 2 | printf("test %i", b); | ^ test.c:2:20: note: each undeclared identifier is reported only once for eac= h=20 function it appears in test.c:3:26: error: =E2=80=98c=E2=80=99 undeclared (first use in this funct= ion) 3 | printf("test=E4=BD=A0=E5=A5=BD %i", c); | ^ Compilation exited abnormally with code 1 at Sat Oct 5 12:13:23 =2D--------------snip--------------- When you click on test.c:2:20, it gets you to the second t in 'test'; if yo= u=20 click on test.c:3:26, you end up on the '%'. The expected result would be = to=20 have the cursor on 'b' and 'c'. The problem has been discussed here two years ago: https://www.reddit.com/r/emacs/comments/5m3i59/ ask_remacs_get_compile_mode_to_treat_column/ Suggested solution: Use byte-to-position to calculate the position in=20 compilation-move-to-column. Since debugging environments can also control Emacs e.g. through emacsclien= t=20 +line:column file, I suggest adding a pattern that indicates that column he= re=20 really means byte position, too, e.g. +line/byte or +line,byte or such. Or= =20 just interpret it as byte position, too. gedit e.g. counts a tab as 1 if y= ou=20 open a file with +line:column options, but counts one UTF-8 glyph also as 1= =20 (which is not how compilers count). Some programming languages convert unicode glyphs and other characters into= =20 internal character types (e.g. JavaScript), and then the gedit behavior or = the=20 behavior with compilation-error-screen-columns set to nil is probably ok. = =20 It's just that we need a byte mode here, too. True and false is not enough. =2D-=20 Bernd Paysan "If you want it done right, you have to do it yourself" net2o id: kQusJzA;7*?t=3Duy@X}1GWr!+0qqp_Cn176t4(dQ* https://net2o.de/ --nextPart1635646.hbdS1Sl0bu Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part. Content-Transfer-Encoding: 7Bit -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEERJ1NDqPQRwYnwBjr9y2Uk5MtoGcFAl2YeqIACgkQ9y2Uk5Mt oGdhbg//f1kZQFeoMmjuQ1I4HytcKDRyv7pfAvwLHdZsIEUYR0ArXuW13cseTqnJ +QSmxLFgU3Y6tht0nXvZ6ozAnR8YYkEIOBMiZYvVl1xgvwqveYlIdML9y6i9TB2U iNoxMLuOJ7Xakoh5RKsfkvdNS/w5sHwpok45vZ43XdTaCgf/QDmN1otDXdTwhqvK sJvAckU5VgHvoYU5i9Y20AmHImxvw4EtSGQSPW/um5rnSRUhn2GG/EWYREpi5Wpt FbGBX+gSN0FMXqzV8ua8o8LQ0fmQDfHw1BGo+N9tc4kua4ZhI/CiB2q2yChmCixa 5Pk2XvgQELgC63XoZ9cGCD8rdIWnztjkUbT0Gso1alQkOTZm801eiPnu53zMVmBk SUQ1sYz0W8gxF1iXiMGz9AFc2AwFULyy1wXlpkwVL+EYY3ecq2RFB5+kldQ7oSiS gGayrWRY/CYKWmelGwqSRzFvYTfy8lOy29YmUsH9A5CDUqwKPyDdWZGEHLc+ekP9 RR2MhM6+gS5Li/iKTwMgjorVpBx+A2E3i1+tBCSZJj8T6cJq4Jw45UHtCiqEq72N M/v5nbARjnAr/HQK7QzQIvkaPiYuEg0bSOuRxK+OaGslPgFHIb6hiRo0Z5J2Cy/n Dr2kXk7/ENfkX0KwcsJ5cwVdLI2nuGYQztbXU1z7AguUePBfDj0= =6/pF -----END PGP SIGNATURE----- --nextPart1635646.hbdS1Sl0bu--