From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Vangelis Evangelou Newsgroups: gmane.emacs.bugs Subject: bug#70816: 29.2; Flymake fails in latex-mode when the buffer is narrowed Date: Sat, 18 May 2024 18:11:58 +0100 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000009ce3dc0618bd927f" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="18985"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Arash Esbati , 70816@debbugs.gnu.org To: Spencer Baugh Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat May 18 19:14:24 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1s8NdX-0004kl-6M for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 18 May 2024 19:14:23 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s8NdH-0002D7-Gm; Sat, 18 May 2024 13:14:07 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s8NdE-0002Cg-B6 for bug-gnu-emacs@gnu.org; Sat, 18 May 2024 13:14:04 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s8Nd9-0007Fv-H9 for bug-gnu-emacs@gnu.org; Sat, 18 May 2024 13:14:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1s8NdC-00080t-1F for bug-gnu-emacs@gnu.org; Sat, 18 May 2024 13:14:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Vangelis Evangelou Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 18 May 2024 17:14:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70816 X-GNU-PR-Package: emacs Original-Received: via spool by 70816-submit@debbugs.gnu.org id=B70816.171605242030753 (code B ref 70816); Sat, 18 May 2024 17:14:01 +0000 Original-Received: (at 70816) by debbugs.gnu.org; 18 May 2024 17:13:40 +0000 Original-Received: from localhost ([127.0.0.1]:34529 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s8Ncp-0007zw-Gx for submit@debbugs.gnu.org; Sat, 18 May 2024 13:13:39 -0400 Original-Received: from mail-lf1-f44.google.com ([209.85.167.44]:59514) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s8Ncn-0007zU-Oh for 70816@debbugs.gnu.org; Sat, 18 May 2024 13:13:38 -0400 Original-Received: by mail-lf1-f44.google.com with SMTP id 2adb3069b0e04-51f71e4970bso3499329e87.2 for <70816@debbugs.gnu.org>; Sat, 18 May 2024 10:13:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716052348; x=1716657148; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=vHmLclqayE2tIp566hPSMMxrK7mJM940EDw4uj3dQU0=; b=hWbz4gTVoI5+GMZ8xIdUqU8mQEcZE+gmSol7ZfziLwLufTzAIJtOqOB3HgxzLFNjgS lEvcWzEYCulD7rtQGZWfmjqEgagDuiser4h/dT8hhize+U14e3gjERKmtvS8vwo6CEnF dpHOhrGHsZptya+g9cRCTGPTRzS/9F0oYOWGxdhz7KiKvCaxxm9wbnxTBn8u2LxdVJKl GgNMKaKZvFIc4mRYH0NCd4Agig3PCtSviNjKz5637JkZqTyZT7hLzeO1m7PljgwFi5SG lLwifGbeaMaYuihp6zwTcDrWBjGH3l1HnYehNqXOXe9z/UhKVi94khLTl5pjBQu1DMEk Sm1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716052348; x=1716657148; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=vHmLclqayE2tIp566hPSMMxrK7mJM940EDw4uj3dQU0=; b=LIpke7Pihk6KUCsAlXByqH+jm+xwoG240tsdxsXL0zBLDY099kInU1KIKRsFPi3VPm 3KsrUW+bK3Du3N/Jj5iere6zLuG5zyCQpIlQlMjqlWDrzA+7HfGaordQ2xW1hii9GZB3 ePN1OvbLvD84WpZGstKPQOkB1jPUmvRAQEBaTiahKuJCFAoN89S6LtZxKsBbXj5EgBnc tCKFyUcfEqtgPZH0+Fjy8Lq97z1ZP03CiCVsqXD8Vzft5jqFuuZDCCRIJJ/6NVUDsjVt K1t47+lTdqoUHoRaZTQHspoD2eaBIakqaxqAE5B6Hfd1EFchB9O9idDG6LK5rxI8oYwo k7KQ== X-Forwarded-Encrypted: i=1; AJvYcCXki/BvZMxqeTzAkgNqfBZgNY7PlErYxuO8Dv5Xgy0nEdEtbbuXM7S3n+pt3dPYWFSYBYop4bN2i/qmjewh9qLwBJ4ANfs= X-Gm-Message-State: AOJu0YzsNeLSHqWmJY+pHR+pu/+DUHCKmwmbdz4AFtoW0aY5e0AyxCTB rDVAeuhZjqMcoeKQooLEuZy2I/jPGW/tDNgCUoZYJfP8jKsb6S7tNUHvEWet51SHSDf4pwt5lts TcJ5yIC6PYhSLygJ4tLZBhJ/W8mM= X-Google-Smtp-Source: AGHT+IGI/KdGlWw16Lk6+GD7zvtMRAU2eurDshw9eII0WK6db/oCfP+fouDhyQRE2lcXWB4RmUKl2q6d8GPc2c19N+0= X-Received: by 2002:ac2:550a:0:b0:519:611f:df49 with SMTP id 2adb3069b0e04-52210277efbmr18918555e87.69.1716052347902; Sat, 18 May 2024 10:12:27 -0700 (PDT) In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:285356 Archived-At: --0000000000009ce3dc0618bd927f Content-Type: text/plain; charset="UTF-8" Hi Spencer. Yes, that does resolve the issue. However, as you hinted, it causes issues with other diagnostic functions. In my tests, `ess-r-flymake' from the emacs speaks statistics (ess) package produces incorrect error positions. I wonder if `flymake-diag-region' should have an optional argument to not widen the buffer before calculating the positions. Best, Vangelis On Sat, 18 May 2024 at 15:58, Spencer Baugh wrote: > Spencer Baugh writes: > > Can you test with the following patch, please? > > Context: > > It looks like the latex-mode flymake diagnostic function, tex-chktex, > widens before sending the buffer contents to the external linter > process. So the line numbers of errors are reported relative to the > widened buffer, not the narrowed buffer. A number of different checkers > in Emacs seem to do the same thing. > > The bug is that these checkers call flymake-diag-region to translate the > line numbers into buffer positions. But flymake-diag-region does not > widen the buffer when doing this translation, so it fails. > > I expect you have some flymake logs of the form "Invalid region line=%s > col=%s". when triggering this bug. > > Probably the right fix in flymake is to make flymake-diag-region widen, > as in the patch I posted, but that's a bit of a behavior change... will > think about it, but it's probably fine. > --0000000000009ce3dc0618bd927f Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Spencer.

Yes, that does r= esolve the issue. However, as you hinted, it causes issues with other diagn= ostic functions. In my tests, `ess-r-flymake' from the emacs speaks sta= tistics (ess) package produces incorrect error positions. I wonder if `flym= ake-diag-region' should have an optional argument to not widen the buff= er before calculating the positions.

Best,
Vangelis

On Sat, 18 May 2024 at 15:58, Spencer Baugh <sbaugh@janestreet.com> wrote:=
Spencer Baugh &= lt;sbaugh@janest= reet.com> writes:
> Can you test with the following patch, please?

Context:

It looks like the latex-mode flymake diagnostic function, tex-chktex,
widens before sending the buffer contents to the external linter
process.=C2=A0 So the line numbers of errors are reported relative to the widened buffer, not the narrowed buffer.=C2=A0 A number of different checke= rs
in Emacs seem to do the same thing.

The bug is that these checkers call flymake-diag-region to translate the line numbers into buffer positions.=C2=A0 But flymake-diag-region does not<= br> widen the buffer when doing this translation, so it fails.

I expect you have some flymake logs of the form "Invalid region line= =3D%s
col=3D%s". when triggering this bug.

Probably the right fix in flymake is to make flymake-diag-region widen,
as in the patch I posted, but that's a bit of a behavior change...=C2= =A0 will
think about it, but it's probably fine.
--0000000000009ce3dc0618bd927f--