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 19:34:59 +0200 Message-ID: <5734355.dGnZCJOEy5@daiyu> References: <2282407.NbK4RY0fEn@daiyu> <83zhif2n0q.fsf@gnu.org> <83y2xz2mmi.fsf@gnu.org> Reply-To: Bernd Paysan Mime-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart2638071.gE4rUgo7W6"; micalg="pgp-sha256"; protocol="application/pgp-signature" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="38846"; mail-complaints-to="usenet@blaine.gmane.org" Cc: 37633@debbugs.gnu.org, anton@mips.complang.tuwien.ac.at To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Oct 05 19:36:11 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 1iGnyV-0009u5-HF for geb-bug-gnu-emacs@m.gmane.org; Sat, 05 Oct 2019 19:36:11 +0200 Original-Received: from localhost ([::1]:58212 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iGnyT-0005uf-IN for geb-bug-gnu-emacs@m.gmane.org; Sat, 05 Oct 2019 13:36:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55512) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iGnyN-0005uW-AA for bug-gnu-emacs@gnu.org; Sat, 05 Oct 2019 13:36:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iGnyM-0003iS-0I for bug-gnu-emacs@gnu.org; Sat, 05 Oct 2019 13:36:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:36323) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iGnyL-0003iN-UB for bug-gnu-emacs@gnu.org; Sat, 05 Oct 2019 13:36:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iGnyL-00041d-PT for bug-gnu-emacs@gnu.org; Sat, 05 Oct 2019 13:36:01 -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 17:36:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 37633 X-GNU-PR-Package: emacs Original-Received: via spool by 37633-submit@debbugs.gnu.org id=B37633.157029690915408 (code B ref 37633); Sat, 05 Oct 2019 17:36:01 +0000 Original-Received: (at 37633) by debbugs.gnu.org; 5 Oct 2019 17:35:09 +0000 Original-Received: from localhost ([127.0.0.1]:45144 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iGnxU-00040R-JQ for submit@debbugs.gnu.org; Sat, 05 Oct 2019 13:35:08 -0400 Original-Received: from mail.net2o.de ([185.183.156.191]:59128) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iGnxS-00040J-Ej for 37633@debbugs.gnu.org; Sat, 05 Oct 2019 13:35:06 -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 EA415400A5; Sat, 5 Oct 2019 19:35:04 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=net2o.de; s=mail; t=1570296905; bh=9mY2eugeTV8iqqnx8ye/M+5m4gJy8OQUIS6itsvMESQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cFzErEqlB/520BJ4w+BAY+LKiPmKLMeHVk7FHCsgEM+0qrP5GKIf9rMvCWqwLWspY gv9tXj/YrCZ9kAKluW5zkne/N/ayW6gl3qz4IfxlSPYKpth+dJfp7v7vxHeI3K/xaT NDwqd1cuFEoJUMsnpuV1IMw7sTUb/8zFUNyp2Eu0= In-Reply-To: <83y2xz2mmi.fsf@gnu.org> 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:168389 Archived-At: --nextPart2638071.gE4rUgo7W6 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="UTF-8" Am Samstag, 5. Oktober 2019, 18:16:53 CEST schrieb Eli Zaretskii: > > Date: Sat, 05 Oct 2019 19:08:21 +0300 > > From: Eli Zaretskii > > Cc: 37633@debbugs.gnu.org, anton@mips.complang.tuwien.ac.at > >=20 > > > Suggested solution: Use byte-to-position to calculate the position in > > > compilation-move-to-column. > >=20 > > This only works in UTF-8 locales, and is not 100% even there, so it > > isn't the right solution. >=20 > In general, byte-to-position is meant to be used only for converting > between byte and character positions of text in Emacs buffers. >=20 > For byte offsets in external text we have bufferpos-to-filepos, but > that requires us to know the encoding of the external text. We need > to find a reasonable way of getting that. Suggestions and patches > welcome. Ok, first I tried bufferpos-to-filepos. (defun compilation-move-to-column (col screen) "Go to column COL on the current line. If SCREEN is non-nil, columns are screen columns, otherwise, they are just char-counts." (setq col (- col compilation-first-column)) (let ((realpos (filepos-to-bufferpos (+ (bufferpos-to-filepos (line- beginning-position) 'approximate) col) 'approximate))) (goto-char (min realpos (line-end-position))))) I left out the (if ) with (screen), because I just wanted to test this case= =2E =20 =46or the examples I've used, it works with the 'approximate setting. I leave out this screen part to the emacs maintainers, because you maybe wa= nt=20 a three-case statement: nil for char-count, 't for screen columns, and=20 'bytepos for byte-accurate position. JavaScript (node) is ok with the char- count mode. Second test-case: iso8859-1 encoded file with void foo() { printf("test %i", b); printf("test=C3=A4=C3=B6=C3=BC %i", c); } =2E.. test-iso.c:3:23: error: =E2=80=98c=E2=80=99 undeclared (first use in this f= unction) 3 | printf("test=EF=BF=BD=EF=BF=BD=EF=BF=BD %i", c); | ^ =2E.. works when you click there, too. =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/ --nextPart2638071.gE4rUgo7W6 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part. Content-Transfer-Encoding: 7Bit -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEERJ1NDqPQRwYnwBjr9y2Uk5MtoGcFAl2Y1EMACgkQ9y2Uk5Mt oGdMxw/+OgPbYCHudx5A3hIn4qLSbX7TVXX2exi195XqAbqPzPt4nsHoev8TxxnE z6HuV5WZba/2ataH/+B6cEzvVYj67OybPi2psQNHQapGFhJcqaETzbAITDF8PRTI G+cgaOnudSoBHB/2BXMxMYgexW8VoQUBdhH5LjxoJF78EwkCd3YgNjQei+RP8VvK +3X95WFWkTsRpwUgZHjb5Qkt1KuzrW4P9YRZLtNLtn1loATghOkrtGC+O3C97Uil cgBZIEobliYZs0Cmhm4Cz4R+wGxxQnowISms1p6eEgi2WD32ku2TqnotIQmchUpo o5NCE7519g3kvQsfsf3bniURzGOGFOKpCo92yYp+9OGHrxNMSjZ1xMAGPM6enyIU C1bQAitCLTPuRBGStlhp7zoN7+GXCkbSKuqGDAQeykfYN97Br7e/+atXCGhzpy8K iy8Q6lF3ItnL1jpZJnpJe2fcvv1/ayD5DyanbUFuzllENwzVg9m5d/5mtTzXxskW C7ECGBmR3HP/dtZEOr3eFJIVi5+oINdCXt5U5FWan1W/ejTud2eUYrDueFRAZD0T 8VFTFQhYIZE6DC1dIzT1/6g7slpd9QtK0xOP7iDvz0wR70uf7kND/0HxSrhVbVfM k153SyWSCvz4NXEGumX4Lun4x7KGux3nMjCuq95Q8+iHU6ydPjs= =hGRI -----END PGP SIGNATURE----- --nextPart2638071.gE4rUgo7W6--