From unknown Sun Jun 15 08:57:10 2025 X-Loop: help-debbugs@gnu.org Subject: bug#26694: preview-at-point fails on very long lines with "End of buffer" Resent-From: Frank Fischer Original-Sender: "Debbugs-submit" Resent-CC: bug-auctex@gnu.org Resent-Date: Fri, 28 Apr 2017 13:30:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 26694 X-GNU-PR-Package: auctex X-GNU-PR-Keywords: To: 26694@debbugs.gnu.org X-Debbugs-Original-To: bug-auctex@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.149338617321052 (code B ref -1); Fri, 28 Apr 2017 13:30:04 +0000 Received: (at submit) by debbugs.gnu.org; 28 Apr 2017 13:29:33 +0000 Received: from localhost ([127.0.0.1]:43779 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d45xk-0005TU-VP for submit@debbugs.gnu.org; Fri, 28 Apr 2017 09:29:33 -0400 Received: from eggs.gnu.org ([208.118.235.92]:37622) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d45xj-0005TI-8k for submit@debbugs.gnu.org; Fri, 28 Apr 2017 09:29:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d45xY-0006Pa-Kj for submit@debbugs.gnu.org; Fri, 28 Apr 2017 09:29:26 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:34384) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d45xY-0006PW-HG for submit@debbugs.gnu.org; Fri, 28 Apr 2017 09:29:20 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56823) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d45xX-0007He-53 for bug-auctex@gnu.org; Fri, 28 Apr 2017 09:29:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d45xU-0006Ok-0B for bug-auctex@gnu.org; Fri, 28 Apr 2017 09:29:19 -0400 Received: from mout3.freenet.de ([2001:748:100:40::2:5]:55999) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d45xT-0006Ns-QA for bug-auctex@gnu.org; Fri, 28 Apr 2017 09:29:15 -0400 Received: from [195.4.92.141] (helo=mjail1.freenet.de) by mout3.freenet.de with esmtpa (ID frank-fischer@shadow-soft.de) (port 25) (Exim 4.85 #1) id 1d45xP-0004Kg-P4 for bug-auctex@gnu.org; Fri, 28 Apr 2017 15:29:11 +0200 Received: from localhost ([::1]:50004 helo=mjail1.freenet.de) by mjail1.freenet.de with esmtpa (ID frank-fischer@shadow-soft.de) (Exim 4.85 #1) id 1d45xP-0002EI-GA for bug-auctex@gnu.org; Fri, 28 Apr 2017 15:29:11 +0200 Received: from mx4.freenet.de ([195.4.92.14]:52493) by mjail1.freenet.de with esmtpa (ID frank-fischer@shadow-soft.de) (Exim 4.85 #1) id 1d45v9-0007kz-S3 for bug-auctex@gnu.org; Fri, 28 Apr 2017 15:26:51 +0200 Received: from math-pc1.mathematik.uni-kassel.de ([141.51.166.2]:55120) by mx4.freenet.de with esmtpsa (ID frank-fischer@shadow-soft.de) (TLSv1.2:DHE-RSA-AES128-SHA:128) (port 465) (Exim 4.85 #1) id 1d45v9-0000X6-NS; Fri, 28 Apr 2017 15:26:51 +0200 From: Frank Fischer Message-ID: <79603651-696f-3cd6-85d8-de2f319ce477@shadow-soft.de> Date: Fri, 28 Apr 2017 15:26:51 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Originated-At: 141.51.166.2!55120 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) Hi, consider the following example file https://pastebin.com/73W7EbCa This file has a single very long line with one math item at the end. Do the following: 1. generate the preview with C-c C-p C-p 2. move point to the "x" in the math block, change it to "y" and leave point within the math block 3. execute C-c C-p C-p again One should get the message "End of buffer" without the preview being regenerated. AFAICT the reason is that in this case only the snippet $x$ without the text preceding the snippet in the line is copied to the temporary file for generating the preview. However line 2103 in tex-buf.el (that is the line with "(forward-char (cdr line-col))") tries to move point to the *original* column of the snippet. This number is so large that "(forward-char ...)" will actually reach the end of the buffer and the error occurs. However, I would say the the column offset is just wrong. Either subtract the length of the preceding text (in the original buffer) from the column number or copy the preceding text to the temp buffer as well. I hope my description is clear, if not, please ask ;) Best regards, Frank From unknown Sun Jun 15 08:57:10 2025 X-Loop: help-debbugs@gnu.org Subject: bug#26694: preview-at-point fails on very long lines with "End of buffer" Resent-From: =?UTF-8?Q?Mos=C3=A8?= Giordano Original-Sender: "Debbugs-submit" Resent-CC: bug-auctex@gnu.org Resent-Date: Fri, 28 Apr 2017 15:44:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 26694 X-GNU-PR-Package: auctex X-GNU-PR-Keywords: To: Frank Fischer Cc: 26694@debbugs.gnu.org Received: via spool by 26694-submit@debbugs.gnu.org id=B26694.14933942122398 (code B ref 26694); Fri, 28 Apr 2017 15:44:01 +0000 Received: (at 26694) by debbugs.gnu.org; 28 Apr 2017 15:43:32 +0000 Received: from localhost ([127.0.0.1]:44883 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d483Q-0000cc-2M for submit@debbugs.gnu.org; Fri, 28 Apr 2017 11:43:32 -0400 Received: from eggs.gnu.org ([208.118.235.92]:46650) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d483O-0000cN-9C for 26694@debbugs.gnu.org; Fri, 28 Apr 2017 11:43:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d483F-0006go-OU for 26694@debbugs.gnu.org; Fri, 28 Apr 2017 11:43:24 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:45011) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d483F-0006gk-Ll for 26694@debbugs.gnu.org; Fri, 28 Apr 2017 11:43:21 -0400 Received: from mail-io0-f180.google.com ([209.85.223.180]:35169) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1d483F-0006zM-A5 for 26694@debbugs.gnu.org; Fri, 28 Apr 2017 11:43:21 -0400 Received: by mail-io0-f180.google.com with SMTP id r16so67799205ioi.2 for <26694@debbugs.gnu.org>; Fri, 28 Apr 2017 08:43:21 -0700 (PDT) X-Gm-Message-State: AN3rC/7b6po6b/Qdz0taGkrlUQqCCgu2J8wxLG56ikooEBOT+8P3cUHS pmMXUgWb3lwJk3dVlhElqTfP9+zESA== X-Received: by 10.157.25.139 with SMTP id k11mr5023802otk.188.1493394199174; Fri, 28 Apr 2017 08:43:19 -0700 (PDT) MIME-Version: 1.0 Received: by 10.157.17.117 with HTTP; Fri, 28 Apr 2017 08:42:38 -0700 (PDT) In-Reply-To: <79603651-696f-3cd6-85d8-de2f319ce477@shadow-soft.de> References: <79603651-696f-3cd6-85d8-de2f319ce477@shadow-soft.de> From: =?UTF-8?Q?Mos=C3=A8?= Giordano Date: Fri, 28 Apr 2017 17:42:38 +0200 X-Gmail-Original-Message-ID: Message-ID: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) Hi Frank, 2017-04-28 15:26 GMT+02:00 Frank Fischer : > Hi, > > consider the following example file https://pastebin.com/73W7EbCa > > This file has a single very long line with one math item at the end. Do > the following: > > 1. generate the preview with C-c C-p C-p > 2. move point to the "x" in the math block, change it to "y" and leave > point within the math block > 3. execute C-c C-p C-p again > > One should get the message "End of buffer" without the preview being > regenerated. > > AFAICT the reason is that in this case only the snippet $x$ without the > text preceding the snippet in the line is copied to the temporary file > for generating the preview. However line 2103 in tex-buf.el (that is the > line with "(forward-char (cdr line-col))") tries to move point to the > *original* column of the snippet. This number is so large that > "(forward-char ...)" will actually reach the end of the buffer and the > error occurs. > > However, I would say the the column offset is just wrong. Either > subtract the length of the preceding text (in the original buffer) from > the column number or copy the preceding text to the temp buffer as well. > > I hope my description is clear, if not, please ask ;) Thanks for the detailed bug report, I can reproduce it. However, right now I don't have the time to dig into it, but I found that the issue should be in `TeX-region-create' and can be reproduced with point on the "y" with --8<---------------cut here---------------start------------->8--- (preview-region (preview-next-border t) (preview-next-border nil)) --8<---------------cut here---------------end--------------->8--- If someone else wants to look into it, please go ahead. Bye, Mos=C3=A8 From unknown Sun Jun 15 08:57:10 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Frank Fischer Subject: bug#26694: closed (Re: bug#26694: preview-at-point fails on very long lines with "End of buffer") Message-ID: References: <79603651-696f-3cd6-85d8-de2f319ce477@shadow-soft.de> X-Gnu-PR-Message: they-closed 26694 X-Gnu-PR-Package: auctex Reply-To: 26694@debbugs.gnu.org Date: Sat, 06 May 2017 18:33:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1494095582-20531-1" This is a multi-part message in MIME format... ------------=_1494095582-20531-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #26694: preview-at-point fails on very long lines with "End of buffer" which was filed against the auctex package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 26694@debbugs.gnu.org. --=20 26694: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D26694 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1494095582-20531-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 26694-done) by debbugs.gnu.org; 6 May 2017 18:32:36 +0000 Received: from localhost ([127.0.0.1]:58544 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d74VP-0005KY-Vz for submit@debbugs.gnu.org; Sat, 06 May 2017 14:32:36 -0400 Received: from eggs.gnu.org ([208.118.235.92]:44046) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d74VO-0005KM-5k for 26694-done@debbugs.gnu.org; Sat, 06 May 2017 14:32:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d74VF-0005DP-Ob for 26694-done@debbugs.gnu.org; Sat, 06 May 2017 14:32:28 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:52871) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d74VF-0005D9-Lc for 26694-done@debbugs.gnu.org; Sat, 06 May 2017 14:32:25 -0400 Received: from mail-oi0-f54.google.com ([209.85.218.54]:35980) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1d74VF-0008Hq-7X for 26694-done@debbugs.gnu.org; Sat, 06 May 2017 14:32:25 -0400 Received: by mail-oi0-f54.google.com with SMTP id h4so16770207oib.3 for <26694-done@debbugs.gnu.org>; Sat, 06 May 2017 11:32:25 -0700 (PDT) X-Gm-Message-State: AN3rC/7g4tOomywSaolB7L9nvQc9gGyXOYkOwu58z976TE0bj+ciOOWl Pi+HhBFxO+GWcNjcEJZcc7bfR5JvCQ== X-Received: by 10.202.177.135 with SMTP id a129mr17867768oif.13.1494095544435; Sat, 06 May 2017 11:32:24 -0700 (PDT) MIME-Version: 1.0 Received: by 10.157.17.117 with HTTP; Sat, 6 May 2017 11:31:44 -0700 (PDT) In-Reply-To: <79603651-696f-3cd6-85d8-de2f319ce477@shadow-soft.de> References: <79603651-696f-3cd6-85d8-de2f319ce477@shadow-soft.de> From: =?UTF-8?Q?Mos=C3=A8_Giordano?= Date: Sat, 6 May 2017 20:31:44 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: bug#26694: preview-at-point fails on very long lines with "End of buffer" To: Frank Fischer Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 26694-done Cc: 26694-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) Hi Frank, 2017-04-28 15:26 GMT+02:00 Frank Fischer : > However, I would say the the column offset is just wrong. Either > subtract the length of the preceding text (in the original buffer) from > the column number or copy the preceding text to the temp buffer as well. I think you're right, a good solution would be to add one more argument to `TeX-region-create' with the adjusted line-col information. However, in order to avoid changing the signature of the function I decided to apply a work around: the point is moved only when `TeX-source-correlate-mode' is non nil (because point is moved only to make forward/inverse search work) and this variable is let-bound to nil when running the preview (forward/inverse search is not needed here). I dropped a few comments about this work-around in the code, in case someone want to improve the fix, maybe as suggested above. In any case, I'm closing this ticket as the issue should be fixed. Thanks for the good bug report Frank! Bye, Mos=C3=A8 ------------=_1494095582-20531-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 28 Apr 2017 13:29:33 +0000 Received: from localhost ([127.0.0.1]:43779 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d45xk-0005TU-VP for submit@debbugs.gnu.org; Fri, 28 Apr 2017 09:29:33 -0400 Received: from eggs.gnu.org ([208.118.235.92]:37622) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d45xj-0005TI-8k for submit@debbugs.gnu.org; Fri, 28 Apr 2017 09:29:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d45xY-0006Pa-Kj for submit@debbugs.gnu.org; Fri, 28 Apr 2017 09:29:26 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:34384) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d45xY-0006PW-HG for submit@debbugs.gnu.org; Fri, 28 Apr 2017 09:29:20 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56823) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d45xX-0007He-53 for bug-auctex@gnu.org; Fri, 28 Apr 2017 09:29:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d45xU-0006Ok-0B for bug-auctex@gnu.org; Fri, 28 Apr 2017 09:29:19 -0400 Received: from mout3.freenet.de ([2001:748:100:40::2:5]:55999) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d45xT-0006Ns-QA for bug-auctex@gnu.org; Fri, 28 Apr 2017 09:29:15 -0400 Received: from [195.4.92.141] (helo=mjail1.freenet.de) by mout3.freenet.de with esmtpa (ID frank-fischer@shadow-soft.de) (port 25) (Exim 4.85 #1) id 1d45xP-0004Kg-P4 for bug-auctex@gnu.org; Fri, 28 Apr 2017 15:29:11 +0200 Received: from localhost ([::1]:50004 helo=mjail1.freenet.de) by mjail1.freenet.de with esmtpa (ID frank-fischer@shadow-soft.de) (Exim 4.85 #1) id 1d45xP-0002EI-GA for bug-auctex@gnu.org; Fri, 28 Apr 2017 15:29:11 +0200 Received: from mx4.freenet.de ([195.4.92.14]:52493) by mjail1.freenet.de with esmtpa (ID frank-fischer@shadow-soft.de) (Exim 4.85 #1) id 1d45v9-0007kz-S3 for bug-auctex@gnu.org; Fri, 28 Apr 2017 15:26:51 +0200 Received: from math-pc1.mathematik.uni-kassel.de ([141.51.166.2]:55120) by mx4.freenet.de with esmtpsa (ID frank-fischer@shadow-soft.de) (TLSv1.2:DHE-RSA-AES128-SHA:128) (port 465) (Exim 4.85 #1) id 1d45v9-0000X6-NS; Fri, 28 Apr 2017 15:26:51 +0200 To: bug-auctex@gnu.org From: Frank Fischer Subject: preview-at-point fails on very long lines with "End of buffer" Message-ID: <79603651-696f-3cd6-85d8-de2f319ce477@shadow-soft.de> Date: Fri, 28 Apr 2017 15:26:51 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Originated-At: 141.51.166.2!55120 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) Hi, consider the following example file https://pastebin.com/73W7EbCa This file has a single very long line with one math item at the end. Do the following: 1. generate the preview with C-c C-p C-p 2. move point to the "x" in the math block, change it to "y" and leave point within the math block 3. execute C-c C-p C-p again One should get the message "End of buffer" without the preview being regenerated. AFAICT the reason is that in this case only the snippet $x$ without the text preceding the snippet in the line is copied to the temporary file for generating the preview. However line 2103 in tex-buf.el (that is the line with "(forward-char (cdr line-col))") tries to move point to the *original* column of the snippet. This number is so large that "(forward-char ...)" will actually reach the end of the buffer and the error occurs. However, I would say the the column offset is just wrong. Either subtract the length of the preceding text (in the original buffer) from the column number or copy the preceding text to the temp buffer as well. I hope my description is clear, if not, please ask ;) Best regards, Frank ------------=_1494095582-20531-1-- From unknown Sun Jun 15 08:57:10 2025 X-Loop: help-debbugs@gnu.org Subject: bug#26694: preview-at-point fails on very long lines with "End of buffer" Resent-From: Ikumi Keita Original-Sender: "Debbugs-submit" Resent-CC: bug-auctex@gnu.org Resent-Date: Sun, 28 May 2017 13:13:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 26694 X-GNU-PR-Package: auctex X-GNU-PR-Keywords: To: 26694@debbugs.gnu.org, mose@gnu.org Received: via spool by 26694-submit@debbugs.gnu.org id=B26694.149597713416173 (code B ref 26694); Sun, 28 May 2017 13:13:01 +0000 Received: (at 26694) by debbugs.gnu.org; 28 May 2017 13:12:14 +0000 Received: from localhost ([127.0.0.1]:41318 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dExzS-0004Cn-6J for submit@debbugs.gnu.org; Sun, 28 May 2017 09:12:14 -0400 Received: from omx13.esk.m4.zaq.ne.jp ([220.152.48.7]:46741) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dExzO-0004CV-T6 for 26694@debbugs.gnu.org; Sun, 28 May 2017 09:12:12 -0400 Received: from omx13.esk.m4.zaq.ne.jp ([220.152.49.27] [220.152.49.27]) by omx13.esk.m4.zaq.ne.jp with ESMTP id <20170528131203305.BHLS.3163.omx13.esk.m4.zaq.ne.jp@omx13.esk.m4.zaq.ne.jp>; Sun, 28 May 2017 22:12:03 +0900 Received: from smtpa11.esk.m4.zaq.ne.jp ([42.144.27.116] [42.144.27.116]) by smtpa11.esk.m4.zaq.ne.jp with ESMTP id <20170528131203235.XRZG.32178.smtpa11.esk.m4.zaq.ne.jp@smtpa11.esk.m4.zaq.ne.jp>; Sun, 28 May 2017 22:12:03 +0900 Received: from localhost (localhost [127.0.0.1]) by freebsd.vmware (Postfix) with ESMTP id 5F9C2139800; Sun, 28 May 2017 22:12:02 +0900 (JST) From: Ikumi Keita Mail-Followup-To: 26694@debbugs.gnu.org, mose@gnu.org In-reply-to: References: <79603651-696f-3cd6-85d8-de2f319ce477@shadow-soft.de> Comments: In-reply-to =?UTF-8?Q?Mos=C3=A8?= Giordano message dated "Sat, 06 May 2017 20:31:44 +0200." X-Mailer: MH-E 8.6; nmh 1.6; GNU Emacs 25.2.1 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Date: Sun, 28 May 2017 22:12:02 +0900 Message-ID: <50008.1495977122@localhost> X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) --=-=-= Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable [ Dropped Frank from the recipients. ] Hi Mos=E8 and all, > I think you're right, a good solution would be to add one more > argument to `TeX-region-create' with the adjusted line-col > information. However, in order to avoid changing the signature of the > function I decided to apply a work around: the point is moved only > when `TeX-source-correlate-mode' is non nil (because point is moved > only to make forward/inverse search work) and this variable is > let-bound to nil when running the preview (forward/inverse search is > not needed here). > I dropped a few comments about this work-around in the code, in case > someone want to improve the fix, maybe as suggested above. In any > case, I'm closing this ticket as the issue should be fixed. I looked into this problem and would like to share my thoughts about this. (1) Some problems of the essentially same origin still remain. (a) Open Frank's sample file and enable TeX-source-correlate-mode. (b) Put the region over "$x$". (c) Type C-c C-p C-r. "End of buffer" error again. C-c C-r gives the same error, too. Here is the relavant codes Mos=E8 modified in tex-buf.el: (when TeX-source-correlate-mode (let ((line-col (with-current-buffer orig-buffer (cons (TeX-line-number-at-pos) (current-column))))) (goto-char (point-min)) (forward-line (1- (abs (- header-offset (car line-col))))) (forward-char (cdr line-col)))) It is this `forward-char' that raises the error. The number returned by `(current-column)' is not correct when, in original buffer, the region starts in the middle of a line and the point is on the first line of the region. If a relatively small region has no newline in it and is put on the rightward enough of a very long line, the returned value is too large for `forward-char'. (2) We can find a function `TeX-region-update-point', which does a similar job but without adjustment of the column. I suppose we can unify them. Considering that, in addition to (1) and (2), update of the position of the point in _region_.tex is only necessary when we invoke viewer, call to `TeX-region-update-point' can be summarized in `TeX-command' with test of `(string=3D name "View")'. I made a tentative patch along these idea and attached it to this message. I stopped using `current-column' and use difference betewwn point and max{beginning of line, beginning of region}. (3) It seems that the feature of forward and inverse search for region file is not mature yet. If I understand correctly, it works only with evince, atril and pdf-tools as viewer, right? The other viewers in `TeX-view-program-list-builtin' receive the file name and line number with "%b" and "%n" expanders, but these are not expanded to suitable value when using region file. Maybe we should add other expanders which work even with region file. (4) Using `current-column' might not be suitable even when we use evince or atril. The function `TeX-evince-sync-view-1' passes required parameters to the viewers like this: (list :struct :int32 (TeX-line-number-at-pos) :int32 (1+ (current-column))) Most of CJK letters count as occuping 2 columns, so the column number is not equal to the number of the characters counting from the beginning of a line. (I don't know what is the correct "column" parameters for evince and atril (number of letters? bytes in UTF8? or other?), so don't know how we should change this part.) Best, Ikumi Keita --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=region-point-update Content-Description: fix for updating point in region file diff --git a/tex-buf.el b/tex-buf.el --- a/tex-buf.el +++ b/tex-buf.el @@ -492,6 +492,11 @@ (setq TeX-current-process-region-p t)) ((eq file #'TeX-master-file) (setq TeX-current-process-region-p nil))) + + ;; When we're operating on a region, we need to update the position + ;; of point in the region file so that forward search works. + (if (string= name "View") (TeX-region-update-point)) + (let ((command (TeX-command-expand (nth 1 (assoc name TeX-command-list)) file)) (hook (nth 2 (assoc name TeX-command-list))) @@ -899,17 +904,21 @@ the current buffer. Does nothing in case the last command hasn't operated on the -region." - (when TeX-current-process-region-p +region or `TeX-source-correlate-mode' is disabled." + (when (and TeX-current-process-region-p TeX-source-correlate-mode)) (let ((region-buf (get-file-buffer (TeX-region-file t))) - (current-line (TeX-line-number-at-pos))) + (orig-line (TeX-current-offset)) + (pos-in-line (- (point) (max (line-beginning-position) + (or TeX-command-region-begin + (region-beginning)))))) (when region-buf (with-current-buffer region-buf (goto-char (point-min)) - (when (re-search-forward "!offset(\\(-?[0-9]+\\)") + (when (re-search-forward "!offset(\\(-?[0-9]+\\)" nil t) (let ((offset (string-to-number (match-string 1)))) (goto-char (point-min)) - (forward-line (- current-line (1+ offset)))))))))) + (forward-line (- orig-line offset)) + (forward-char pos-in-line)))))))) (defun TeX-view () "Start a viewer without confirmation. @@ -918,11 +927,7 @@ (interactive) (let ((output-file (TeX-active-master (TeX-output-extension)))) (if (file-exists-p output-file) - (progn - ;; When we're operating on a region, we need to update the position - ;; of point in the region file so that forward search works. - (TeX-region-update-point) - (TeX-command "View" 'TeX-active-master 0)) + (TeX-command "View" 'TeX-active-master 0) (message "Output file %S does not exist." output-file)))) (defun TeX-output-style-check (styles) @@ -2140,17 +2145,6 @@ ") }\n" trailer) (setq TeX-region-orig-buffer orig-buffer) - ;; Position point at the line/col that corresponds to point's line in - ;; orig-buffer in order to make forward search work. Move point only - ;; when `TeX-source-correlate-mode' is non-nil, in order to work around - ;; bug#26694. - (when TeX-source-correlate-mode - (let ((line-col (with-current-buffer orig-buffer - (cons (TeX-line-number-at-pos) - (current-column))))) - (goto-char (point-min)) - (forward-line (1- (abs (- header-offset (car line-col))))) - (forward-char (cdr line-col)))) (run-hooks 'TeX-region-hook) (if (string-equal (buffer-string) original-content) (set-buffer-modified-p nil) --=-=-=-- From unknown Sun Jun 15 08:57:10 2025 X-Loop: help-debbugs@gnu.org Subject: bug#26694: preview-at-point fails on very long lines with "End of buffer" Resent-From: =?UTF-8?Q?Mos=C3=A8?= Giordano Original-Sender: "Debbugs-submit" Resent-CC: bug-auctex@gnu.org Resent-Date: Sun, 28 May 2017 15:59:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 26694 X-GNU-PR-Package: auctex X-GNU-PR-Keywords: To: 26694@debbugs.gnu.org, =?UTF-8?Q?Mos=C3=A8?= Giordano Received: via spool by 26694-submit@debbugs.gnu.org id=B26694.149598714131198 (code B ref 26694); Sun, 28 May 2017 15:59:02 +0000 Received: (at 26694) by debbugs.gnu.org; 28 May 2017 15:59:01 +0000 Received: from localhost ([127.0.0.1]:41891 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dF0ar-000875-Cd for submit@debbugs.gnu.org; Sun, 28 May 2017 11:59:01 -0400 Received: from eggs.gnu.org ([208.118.235.92]:57569) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dF0aq-00086t-Gv for 26694@debbugs.gnu.org; Sun, 28 May 2017 11:59:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dF0ai-0008KI-5v for 26694@debbugs.gnu.org; Sun, 28 May 2017 11:58:55 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: * X-Spam-Status: No, score=1.3 required=5.0 tests=BAYES_50,RCVD_IN_SORBS_SPAM, RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:46504) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dF0ai-0008KE-2h for 26694@debbugs.gnu.org; Sun, 28 May 2017 11:58:52 -0400 Received: from mail-oi0-f41.google.com ([209.85.218.41]:36260) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1dF0ah-00021T-Lc for 26694@debbugs.gnu.org; Sun, 28 May 2017 11:58:51 -0400 Received: by mail-oi0-f41.google.com with SMTP id h4so57040049oib.3 for <26694@debbugs.gnu.org>; Sun, 28 May 2017 08:58:51 -0700 (PDT) X-Gm-Message-State: AODbwcCIeQ+geKSHqiK6n6axrSqXGHRT7LyQGP2X66ahfoAbUlDxt3Ox xCDpbxsoy0eHkKkJAiTDjVS0ZYudvg== X-Received: by 10.157.52.98 with SMTP id v89mr280532otb.160.1495987130483; Sun, 28 May 2017 08:58:50 -0700 (PDT) MIME-Version: 1.0 Received: by 10.157.17.117 with HTTP; Sun, 28 May 2017 08:58:10 -0700 (PDT) In-Reply-To: <50008.1495977122@localhost> References: <79603651-696f-3cd6-85d8-de2f319ce477@shadow-soft.de> <50008.1495977122@localhost> From: =?UTF-8?Q?Mos=C3=A8?= Giordano Date: Sun, 28 May 2017 17:58:10 +0200 X-Gmail-Original-Message-ID: Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -4.5 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.5 (----) Hi Keita, 2017-05-28 15:12 GMT+02:00 Ikumi Keita : > I looked into this problem and would like to share my thoughts about > this. Thanks! As I said, mine was more a workaround rather than a real fix, I'm happy someone else is addressing the issue :-) > (1) Some problems of the essentially same origin still remain. > (a) Open Frank's sample file and enable TeX-source-correlate-mode. > (b) Put the region over "$x$". > (c) Type C-c C-p C-r. "End of buffer" error again. C-c C-r gives > the same error, too. > > Here is the relavant codes Mos=C3=A8 modified in tex-buf.el: > (when TeX-source-correlate-mode > (let ((line-col (with-current-buffer orig-buffer > (cons (TeX-line-number-at-pos) > (current-column))))) > (goto-char (point-min)) > (forward-line (1- (abs (- header-offset (car line-col))))) > (forward-char (cdr line-col)))) > It is this `forward-char' that raises the error. The number > returned by `(current-column)' is not correct when, in original > buffer, the region starts in the middle of a line and the point is > on the first line of the region. If a relatively small region has > no newline in it and is put on the rightward enough of a very long > line, the returned value is too large for `forward-char'. > > (2) We can find a function `TeX-region-update-point', which does a > similar job but without adjustment of the column. I suppose we can > unify them. > > Considering that, in addition to (1) and (2), update of the position of > the point in _region_.tex is only necessary when we invoke viewer, call > to `TeX-region-update-point' can be summarized in `TeX-command' with > test of `(string=3D name "View")'. > > I made a tentative patch along these idea and attached it to this > message. I stopped using `current-column' and use difference betewwn > point and max{beginning of line, beginning of region}. I like your approach! In addition, this doesn't need changing the arguments of `TeX-region-create', that's what I wanted to avoid. > (3) It seems that the feature of forward and inverse search for region > file is not mature yet. If I understand correctly, it works only > with evince, atril and pdf-tools as viewer, right? Evince and Atril yes (see release notes for AUCTeX 11.89), I don't know about pdf-tools but it's possible. > The other > viewers in `TeX-view-program-list-builtin' receive the file name and > line number with "%b" and "%n" expanders, but these are not expanded > to suitable value when using region file. > Maybe we should add other expanders which work even with region > file. Other expanders? Why not adapting the existing ones? Anyway, I'm not sure that inverse search would work with other viewers. > (4) Using `current-column' might not be suitable even when we use evince > or atril. The function `TeX-evince-sync-view-1' passes required > parameters to the viewers like this: > (list :struct :int32 (TeX-line-number-at-pos) > :int32 (1+ (current-column))) > Most of CJK letters count as occuping 2 columns, so the column > number is not equal to the number of the characters counting from > the beginning of a line. (I don't know what is the correct > "column" parameters for evince and atril (number of letters? > bytes in UTF8? or other?), so don't know how we should change this > part.) I don't know, sorry. Bye, Mos=C3=A8 From unknown Sun Jun 15 08:57:10 2025 X-Loop: help-debbugs@gnu.org Subject: bug#26694: preview-at-point fails on very long lines with "End of buffer" Resent-From: Ikumi Keita Original-Sender: "Debbugs-submit" Resent-CC: bug-auctex@gnu.org Resent-Date: Mon, 29 May 2017 14:34:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 26694 X-GNU-PR-Package: auctex X-GNU-PR-Keywords: To: =?UTF-8?Q?Mos=C3=A8?= Giordano Cc: 26694@debbugs.gnu.org Received: via spool by 26694-submit@debbugs.gnu.org id=B26694.14960684046081 (code B ref 26694); Mon, 29 May 2017 14:34:01 +0000 Received: (at 26694) by debbugs.gnu.org; 29 May 2017 14:33:24 +0000 Received: from localhost ([127.0.0.1]:43464 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dFLjX-0001a1-RM for submit@debbugs.gnu.org; Mon, 29 May 2017 10:33:24 -0400 Received: from omx25.esk.m4.zaq.ne.jp ([220.152.48.14]:45147) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dFLjU-0001Zk-FN for 26694@debbugs.gnu.org; Mon, 29 May 2017 10:33:21 -0400 Received: from omx25.esk.m4.zaq.ne.jp ([220.152.49.33] [220.152.49.33]) by omx25.esk.m4.zaq.ne.jp with ESMTP id <20170529143312714.CTEL.3135.omx25.esk.m4.zaq.ne.jp@omx25.esk.m4.zaq.ne.jp>; Mon, 29 May 2017 23:33:12 +0900 Received: from smtpa22.esk.m4.zaq.ne.jp ([42.144.27.116] [42.144.27.116]) by smtpa22.esk.m4.zaq.ne.jp with ESMTP id <20170529143312641.YKSS.25520.smtpa22.esk.m4.zaq.ne.jp@smtpa22.esk.m4.zaq.ne.jp>; Mon, 29 May 2017 23:33:12 +0900 Received: from localhost (localhost [127.0.0.1]) by freebsd.vmware (Postfix) with ESMTP id 9EFF5139800; Mon, 29 May 2017 23:33:11 +0900 (JST) From: Ikumi Keita In-reply-to: References: <79603651-696f-3cd6-85d8-de2f319ce477@shadow-soft.de> <50008.1495977122@localhost> Comments: In-reply-to =?UTF-8?Q?Mos=C3=A8?= Giordano message dated "Sun, 28 May 2017 17:58:10 +0200." X-Mailer: MH-E 8.6; nmh 1.6; GNU Emacs 25.2.1 MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Date: Mon, 29 May 2017 23:33:11 +0900 Message-ID: <52847.1496068391@localhost> X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) Hi! >>>>> Mos=E8 Giordano writes: >> I made a tentative patch along these idea and attached it to this >> message. I stopped using `current-column' and use difference betewwn >> point and max{beginning of line, beginning of region}. > I like your approach! In addition, this doesn't need changing the > arguments of `TeX-region-create', that's what I wanted to avoid. Thanks, then my idea seems to be acceptable. >> (3) It seems that the feature of forward and inverse search for region >> file is not mature yet. If I understand correctly, it works only >> with evince, atril and pdf-tools as viewer, right? > Evince and Atril yes (see release notes for AUCTeX 11.89), I don't > know about pdf-tools but it's possible. I see. Thanks for confirmation. >> The other viewers in `TeX-view-program-list-builtin' receive the file >> name and line number with "%b" and "%n" expanders, but these are not >> expanded to suitable value when using region file. >> Maybe we should add other expanders which work even with region >> file. > Anyway, I'm not sure that inverse search would work with other > viewers. Gosh, these viewers use emacslient on reverse search, which ends up with opening _region_.tex buffer instead of the original document's buffer when using region file. Then it's not so useful to arrange the expanders to work with region file in forward search... > Other expanders? Why not adapting the existing ones? What was in my mind was the user customization. If someone has set up one's `TeX-command-list' to use "%b" or "%n" and that relies on the current behavior, i.e., to give the original file's name or line number instead of _region_.tex's, then arranging them will break that customization. (Of course I estimate such probability to be very low.) >> (4) Using `current-column' might not be suitable even when we use evince >> or atril. The function `TeX-evince-sync-view-1' passes required >> parameters to the viewers like this: >> (list :struct :int32 (TeX-line-number-at-pos) >> :int32 (1+ (current-column))) >> Most of CJK letters count as occuping 2 columns, so the column >> number is not equal to the number of the characters counting from >> the beginning of a line. (I don't know what is the correct >> "column" parameters for evince and atril (number of letters? >> bytes in UTF8? or other?), so don't know how we should change this >> part.) > I don't know, sorry. No problem, thank you. Then I will add some comments above the `current-column'. And I noticed that `(TeX-line-number-at-pos)' should be replaced with `(1+ (TeX-current-offset))' like `TeX-current-line' does, because the former does not return the required value for the viewer when narrowing is in effect. Regards, Ikumi Keita From unknown Sun Jun 15 08:57:10 2025 X-Loop: help-debbugs@gnu.org Subject: bug#26694: preview-at-point fails on very long lines with "End of buffer" Resent-From: =?UTF-8?Q?Mos=C3=A8?= Giordano Original-Sender: "Debbugs-submit" Resent-CC: bug-auctex@gnu.org Resent-Date: Mon, 29 May 2017 15:37:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 26694 X-GNU-PR-Package: auctex X-GNU-PR-Keywords: To: Ikumi Keita Cc: 26694@debbugs.gnu.org Received: via spool by 26694-submit@debbugs.gnu.org id=B26694.149607221611589 (code B ref 26694); Mon, 29 May 2017 15:37:01 +0000 Received: (at 26694) by debbugs.gnu.org; 29 May 2017 15:36:56 +0000 Received: from localhost ([127.0.0.1]:43497 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dFMj1-00030r-Oq for submit@debbugs.gnu.org; Mon, 29 May 2017 11:36:55 -0400 Received: from eggs.gnu.org ([208.118.235.92]:33677) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dFMj0-00030e-J4 for 26694@debbugs.gnu.org; Mon, 29 May 2017 11:36:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dFMiq-0007O2-5s for 26694@debbugs.gnu.org; Mon, 29 May 2017 11:36:49 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: * X-Spam-Status: No, score=1.3 required=5.0 tests=BAYES_50,RCVD_IN_SORBS_SPAM, RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:35210) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dFMiq-0007Nv-2T for 26694@debbugs.gnu.org; Mon, 29 May 2017 11:36:44 -0400 Received: from mail-oi0-f51.google.com ([209.85.218.51]:34238) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1dFMip-0005co-IB for 26694@debbugs.gnu.org; Mon, 29 May 2017 11:36:43 -0400 Received: by mail-oi0-f51.google.com with SMTP id b204so82453079oii.1 for <26694@debbugs.gnu.org>; Mon, 29 May 2017 08:36:43 -0700 (PDT) X-Gm-Message-State: AODbwcDvZZLH+xfLZ/tUlVMD9GjeYciQDyJke0PA7D4K8Y4njew7sLAN D4oCwMpdSd+fovqwzfK4nI8GMrMTPg== X-Received: by 10.202.65.194 with SMTP id o185mr6138356oia.10.1496072202598; Mon, 29 May 2017 08:36:42 -0700 (PDT) MIME-Version: 1.0 Received: by 10.157.17.117 with HTTP; Mon, 29 May 2017 08:36:02 -0700 (PDT) In-Reply-To: <52847.1496068391@localhost> References: <79603651-696f-3cd6-85d8-de2f319ce477@shadow-soft.de> <50008.1495977122@localhost> <52847.1496068391@localhost> From: =?UTF-8?Q?Mos=C3=A8?= Giordano Date: Mon, 29 May 2017 17:36:02 +0200 X-Gmail-Original-Message-ID: Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -4.5 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.5 (----) 2017-05-29 16:33 GMT+02:00 Ikumi Keita : > Gosh, these viewers use emacslient on reverse search, which ends up with > opening _region_.tex buffer instead of the original document's buffer > when using region file. Then it's not so useful to arrange the > expanders to work with region file in forward search... Exactly. In the case of Evince (and Atril) and pdf-tools, AUCTeX can talk with the viewer and tell it that to go back to the original document. This isn't possible in other cases, where the viewers only read the SyncTeX file, which points to _region_.tex. Bye, Mos=C3=A8 From unknown Sun Jun 15 08:57:10 2025 X-Loop: help-debbugs@gnu.org Subject: bug#26694: preview-at-point fails on very long lines with "End of buffer" Resent-From: Ikumi Keita Original-Sender: "Debbugs-submit" Resent-CC: bug-auctex@gnu.org Resent-Date: Tue, 30 May 2017 13:51:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 26694 X-GNU-PR-Package: auctex X-GNU-PR-Keywords: To: =?UTF-8?Q?Mos=C3=A8?= Giordano Cc: 26694@debbugs.gnu.org Received: via spool by 26694-submit@debbugs.gnu.org id=B26694.149615221211232 (code B ref 26694); Tue, 30 May 2017 13:51:02 +0000 Received: (at 26694) by debbugs.gnu.org; 30 May 2017 13:50:12 +0000 Received: from localhost ([127.0.0.1]:44294 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dFhXI-0002v4-2V for submit@debbugs.gnu.org; Tue, 30 May 2017 09:50:12 -0400 Received: from omx25.esk.m4.zaq.ne.jp ([220.152.48.14]:57272) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dFhXF-0002un-QW for 26694@debbugs.gnu.org; Tue, 30 May 2017 09:50:11 -0400 Received: from omx25.esk.m4.zaq.ne.jp ([220.152.49.32] [220.152.49.32]) by omx25.esk.m4.zaq.ne.jp with ESMTP id <20170530135002511.EGPA.3135.omx25.esk.m4.zaq.ne.jp@omx25.esk.m4.zaq.ne.jp>; Tue, 30 May 2017 22:50:02 +0900 Received: from smtpa21.esk.m4.zaq.ne.jp ([42.144.27.116] [42.144.27.116]) by smtpa21.esk.m4.zaq.ne.jp with ESMTP id <20170530135002443.ETS.26886.smtpa21.esk.m4.zaq.ne.jp@smtpa21.esk.m4.zaq.ne.jp>; Tue, 30 May 2017 22:50:02 +0900 Received: from localhost (localhost [127.0.0.1]) by freebsd.vmware (Postfix) with ESMTP id 49D70139800; Tue, 30 May 2017 22:50:02 +0900 (JST) From: Ikumi Keita In-reply-to: References: <79603651-696f-3cd6-85d8-de2f319ce477@shadow-soft.de> <50008.1495977122@localhost> <52847.1496068391@localhost> Comments: In-reply-to =?UTF-8?Q?Mos=C3=A8?= Giordano message dated "Mon, 29 May 2017 17:36:02 +0200." X-Mailer: MH-E 8.6; nmh 1.6; GNU Emacs 25.2.1 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Date: Tue, 30 May 2017 22:50:02 +0900 Message-ID: <55517.1496152202@localhost> X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) --=-=-= Content-Type: text/plain Hi all, Now I propose to apply the attached fix. This doesn't change the action of "%b" and "%n". If no objection, I'll commit it soon. Bye, Ikumi Keita --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=improve-fix-end-of-buffer.diff Content-Description: Additonal fix for bug#26694 diff --git a/preview.el.in b/preview.el.in --- a/preview.el.in +++ b/preview.el.in @@ -1622,11 +1622,8 @@ (unless (eq preview-state 'disabled) (preview-toggle ovr 'toggle (selected-window)) (throw 'exit t))))) - ;; Let-bind `TeX-source-correlate-mode' to nil in order to work around - ;; bug#26694. - (let ((TeX-source-correlate-mode nil)) - (preview-region (preview-next-border t) - (preview-next-border nil)))))) + (preview-region (preview-next-border t) + (preview-next-border nil))))) (defun preview-disabled-string (ov) "Generate a before-string for disabled preview overlay OV." diff --git a/tex-buf.el b/tex-buf.el --- a/tex-buf.el +++ b/tex-buf.el @@ -492,6 +492,11 @@ (setq TeX-current-process-region-p t)) ((eq file #'TeX-master-file) (setq TeX-current-process-region-p nil))) + + ;; When we're operating on a region, we need to update the position + ;; of point in the region file so that forward search works. + (if (string= name "View") (TeX-region-update-point)) + (let ((command (TeX-command-expand (nth 1 (assoc name TeX-command-list)) file)) (hook (nth 2 (assoc name TeX-command-list))) @@ -899,17 +904,21 @@ the current buffer. Does nothing in case the last command hasn't operated on the -region." - (when TeX-current-process-region-p +region or `TeX-source-correlate-mode' is disabled." + (when (and TeX-current-process-region-p TeX-source-correlate-mode)) (let ((region-buf (get-file-buffer (TeX-region-file t))) - (current-line (TeX-line-number-at-pos))) + (orig-line (TeX-current-offset)) + (pos-in-line (- (point) (max (line-beginning-position) + (or TeX-command-region-begin + (region-beginning)))))) (when region-buf (with-current-buffer region-buf (goto-char (point-min)) - (when (re-search-forward "!offset(\\(-?[0-9]+\\)") + (when (re-search-forward "!offset(\\(-?[0-9]+\\)" nil t) (let ((offset (string-to-number (match-string 1)))) (goto-char (point-min)) - (forward-line (- current-line (1+ offset)))))))))) + (forward-line (- orig-line offset)) + (forward-char pos-in-line)))))))) (defun TeX-view () "Start a viewer without confirmation. @@ -918,11 +927,7 @@ (interactive) (let ((output-file (TeX-active-master (TeX-output-extension)))) (if (file-exists-p output-file) - (progn - ;; When we're operating on a region, we need to update the position - ;; of point in the region file so that forward search works. - (TeX-region-update-point) - (TeX-command "View" 'TeX-active-master 0)) + (TeX-command "View" 'TeX-active-master 0) (message "Output file %S does not exist." output-file)))) (defun TeX-output-style-check (styles) @@ -2140,17 +2145,6 @@ ") }\n" trailer) (setq TeX-region-orig-buffer orig-buffer) - ;; Position point at the line/col that corresponds to point's line in - ;; orig-buffer in order to make forward search work. Move point only - ;; when `TeX-source-correlate-mode' is non-nil, in order to work around - ;; bug#26694. - (when TeX-source-correlate-mode - (let ((line-col (with-current-buffer orig-buffer - (cons (TeX-line-number-at-pos) - (current-column))))) - (goto-char (point-min)) - (forward-line (1- (abs (- header-offset (car line-col))))) - (forward-char (cdr line-col)))) (run-hooks 'TeX-region-hook) (if (string-equal (buffer-string) original-content) (set-buffer-modified-p nil) diff --git a/tex.el b/tex.el --- a/tex.el +++ b/tex.el @@ -1335,7 +1335,13 @@ (format "org.%s.%s.Window" de app) "SyncView" (buffer-file-name) - (list :struct :int32 (TeX-line-number-at-pos) + (list :struct :int32 (1+ (TeX-current-offset)) + ;; FIXME: Using `current-column' here is dubious. + ;; Most of CJK letters count as occupying 2 columns, + ;; so the column number is not equal to the number of + ;; the characters counting from the beginning of a + ;; line. What is the right number to specify here? + ;; number of letters? bytes in UTF8? or other? :int32 (1+ (current-column))) :uint32 0)) (error "Couldn't find the %s instance for %s" (capitalize app) uri)))) @@ -1385,7 +1391,7 @@ "%d" (mode-io-correlate " \"# %n '%b'\"")) "dviout") ("SumatraPDF" ("SumatraPDF -reuse-instance" - (mode-io-correlate " -forward-search \"%b\" %n") " %o") + (mode-io-correlate " -forward-search %b %n") " %o") "SumatraPDF") ("dvips and start" "dvips %d -o && start \"\" %f" "dvips") ("start" "start \"\" %o"))) @@ -2090,11 +2096,14 @@ (let ((synctex-output (with-output-to-string (call-process "synctex" nil (list standard-output nil) nil "view" - "-i" (format "%s:%s:%s" (TeX-line-number-at-pos) - (current-column) + "-i" (format "%s:%s:%s" (1+ (TeX-current-offset)) + ;; FIXME: Using `current-column' + ;; here is dubious. See comment in + ;; `TeX-evince-sync-view-1'. + (1+ (current-column)) file) "-o" (TeX-active-master (TeX-output-extension)))))) - (when (string-match "Page:\\([0-9]+\\)" synctex-output) + (when (string-match "^Page:\\([0-9]+\\)" synctex-output) (match-string 1 synctex-output)))) (defun TeX-synctex-output-page () --=-=-=-- From unknown Sun Jun 15 08:57:10 2025 X-Loop: help-debbugs@gnu.org Subject: bug#26694: preview-at-point fails on very long lines with "End of buffer" Resent-From: Ikumi Keita Original-Sender: "Debbugs-submit" Resent-CC: bug-auctex@gnu.org Resent-Date: Tue, 30 May 2017 14:10:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 26694 X-GNU-PR-Package: auctex X-GNU-PR-Keywords: Cc: 26694@debbugs.gnu.org, =?UTF-8?Q?Mos=C3=A8?= Giordano Received: via spool by 26694-submit@debbugs.gnu.org id=B26694.149615337821292 (code B ref 26694); Tue, 30 May 2017 14:10:02 +0000 Received: (at 26694) by debbugs.gnu.org; 30 May 2017 14:09:38 +0000 Received: from localhost ([127.0.0.1]:45367 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dFhq4-0005XL-KX for submit@debbugs.gnu.org; Tue, 30 May 2017 10:09:36 -0400 Received: from omx25.esk.m4.zaq.ne.jp ([220.152.48.14]:49816) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dFhq2-0005X8-9j for 26694@debbugs.gnu.org; Tue, 30 May 2017 10:09:35 -0400 Received: from omx25.esk.m4.zaq.ne.jp ([220.152.49.28] [220.152.49.28]) by omx25.esk.m4.zaq.ne.jp with ESMTP id <20170530140927935.EHEL.3135.omx25.esk.m4.zaq.ne.jp@omx25.esk.m4.zaq.ne.jp>; Tue, 30 May 2017 23:09:27 +0900 Received: from smtpa12.esk.m4.zaq.ne.jp ([42.144.27.116] [42.144.27.116]) by smtpa12.esk.m4.zaq.ne.jp with ESMTP id <20170530140927849.HXT.3043.smtpa12.esk.m4.zaq.ne.jp@smtpa12.esk.m4.zaq.ne.jp>; Tue, 30 May 2017 23:09:27 +0900 Received: from localhost (localhost [127.0.0.1]) by freebsd.vmware (Postfix) with ESMTP id 8EC94139800; Tue, 30 May 2017 23:09:27 +0900 (JST) From: Ikumi Keita In-reply-to: <55517.1496152202@localhost> References: <79603651-696f-3cd6-85d8-de2f319ce477@shadow-soft.de> <50008.1495977122@localhost> <52847.1496068391@localhost> <55517.1496152202@localhost> Comments: In-reply-to Ikumi Keita message dated "Tue, 30 May 2017 22:50:02 +0900." X-Mailer: MH-E 8.6; nmh 1.6; GNU Emacs 25.2.1 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Date: Tue, 30 May 2017 23:09:27 +0900 Message-ID: <55972.1496153367@localhost> X-Spam-Score: 1.2 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Sorry, the previous patch contains a spurious ")" in it. Please dismiss it and use the attached one instead. Bye, Ikumi Keita diff --git a/preview.el.in b/preview.el.in --- a/preview.el.in +++ b/preview.el.in @@ -1622,11 +1622,8 @@ (unless (eq preview-state 'disabled) (preview-toggle ovr 'toggle (selected-window)) (throw 'exit t))))) - ; ; Let-bind `TeX-source-correlate-mode' to nil in order to work around - ; ; bug#26694. - (let ((TeX-source-correlate-mode nil)) - (preview-region (preview-next-border t) - (preview-next-border nil)))))) + (preview-region (preview-next-border t) + (preview-next-border nil))))) [...] Content analysis details: (1.2 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 1.2 MISSING_HEADERS Missing To: header X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.2 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Sorry, the previous patch contains a spurious ")" in it. Please dismiss it and use the attached one instead. Bye, Ikumi Keita diff --git a/preview.el.in b/preview.el.in --- a/preview.el.in +++ b/preview.el.in @@ -1622,11 +1622,8 @@ (unless (eq preview-state 'disabled) (preview-toggle ovr 'toggle (selected-window)) (throw 'exit t))))) - ;; Let-bind `TeX-source-correlate-mode' to nil in order to work around - ;; bug#26694. - (let ((TeX-source-correlate-mode nil)) - (preview-region (preview-next-border t) - (preview-next-border nil)))))) + (preview-region (preview-next-border t) + (preview-next-border nil))))) [...] Content analysis details: (1.2 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 1.2 MISSING_HEADERS Missing To: header --=-=-= Content-Type: text/plain Sorry, the previous patch contains a spurious ")" in it. Please dismiss it and use the attached one instead. Bye, Ikumi Keita --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=improve-fix-end-of-buffer-revised.diff Content-Description: revised patch diff --git a/preview.el.in b/preview.el.in --- a/preview.el.in +++ b/preview.el.in @@ -1622,11 +1622,8 @@ (unless (eq preview-state 'disabled) (preview-toggle ovr 'toggle (selected-window)) (throw 'exit t))))) - ;; Let-bind `TeX-source-correlate-mode' to nil in order to work around - ;; bug#26694. - (let ((TeX-source-correlate-mode nil)) - (preview-region (preview-next-border t) - (preview-next-border nil)))))) + (preview-region (preview-next-border t) + (preview-next-border nil))))) (defun preview-disabled-string (ov) "Generate a before-string for disabled preview overlay OV." diff --git a/tex-buf.el b/tex-buf.el --- a/tex-buf.el +++ b/tex-buf.el @@ -492,6 +492,11 @@ (setq TeX-current-process-region-p t)) ((eq file #'TeX-master-file) (setq TeX-current-process-region-p nil))) + + ;; When we're operating on a region, we need to update the position + ;; of point in the region file so that forward search works. + (if (string= name "View") (TeX-region-update-point)) + (let ((command (TeX-command-expand (nth 1 (assoc name TeX-command-list)) file)) (hook (nth 2 (assoc name TeX-command-list))) @@ -899,17 +904,21 @@ the current buffer. Does nothing in case the last command hasn't operated on the -region." - (when TeX-current-process-region-p +region or `TeX-source-correlate-mode' is disabled." + (when (and TeX-current-process-region-p TeX-source-correlate-mode) (let ((region-buf (get-file-buffer (TeX-region-file t))) - (current-line (TeX-line-number-at-pos))) + (orig-line (TeX-current-offset)) + (pos-in-line (- (point) (max (line-beginning-position) + (or TeX-command-region-begin + (region-beginning)))))) (when region-buf (with-current-buffer region-buf (goto-char (point-min)) - (when (re-search-forward "!offset(\\(-?[0-9]+\\)") + (when (re-search-forward "!offset(\\(-?[0-9]+\\)" nil t) (let ((offset (string-to-number (match-string 1)))) (goto-char (point-min)) - (forward-line (- current-line (1+ offset)))))))))) + (forward-line (- orig-line offset)) + (forward-char pos-in-line)))))))) (defun TeX-view () "Start a viewer without confirmation. @@ -918,11 +927,7 @@ (interactive) (let ((output-file (TeX-active-master (TeX-output-extension)))) (if (file-exists-p output-file) - (progn - ;; When we're operating on a region, we need to update the position - ;; of point in the region file so that forward search works. - (TeX-region-update-point) - (TeX-command "View" 'TeX-active-master 0)) + (TeX-command "View" 'TeX-active-master 0) (message "Output file %S does not exist." output-file)))) (defun TeX-output-style-check (styles) @@ -2140,17 +2145,6 @@ ") }\n" trailer) (setq TeX-region-orig-buffer orig-buffer) - ;; Position point at the line/col that corresponds to point's line in - ;; orig-buffer in order to make forward search work. Move point only - ;; when `TeX-source-correlate-mode' is non-nil, in order to work around - ;; bug#26694. - (when TeX-source-correlate-mode - (let ((line-col (with-current-buffer orig-buffer - (cons (TeX-line-number-at-pos) - (current-column))))) - (goto-char (point-min)) - (forward-line (1- (abs (- header-offset (car line-col))))) - (forward-char (cdr line-col)))) (run-hooks 'TeX-region-hook) (if (string-equal (buffer-string) original-content) (set-buffer-modified-p nil) diff --git a/tex.el b/tex.el --- a/tex.el +++ b/tex.el @@ -1335,7 +1335,13 @@ (format "org.%s.%s.Window" de app) "SyncView" (buffer-file-name) - (list :struct :int32 (TeX-line-number-at-pos) + (list :struct :int32 (1+ (TeX-current-offset)) + ;; FIXME: Using `current-column' here is dubious. + ;; Most of CJK letters count as occupying 2 columns, + ;; so the column number is not equal to the number of + ;; the characters counting from the beginning of a + ;; line. What is the right number to specify here? + ;; number of letters? bytes in UTF8? or other? :int32 (1+ (current-column))) :uint32 0)) (error "Couldn't find the %s instance for %s" (capitalize app) uri)))) @@ -1385,7 +1391,7 @@ "%d" (mode-io-correlate " \"# %n '%b'\"")) "dviout") ("SumatraPDF" ("SumatraPDF -reuse-instance" - (mode-io-correlate " -forward-search \"%b\" %n") " %o") + (mode-io-correlate " -forward-search %b %n") " %o") "SumatraPDF") ("dvips and start" "dvips %d -o && start \"\" %f" "dvips") ("start" "start \"\" %o"))) @@ -2090,11 +2096,14 @@ (let ((synctex-output (with-output-to-string (call-process "synctex" nil (list standard-output nil) nil "view" - "-i" (format "%s:%s:%s" (TeX-line-number-at-pos) - (current-column) + "-i" (format "%s:%s:%s" (1+ (TeX-current-offset)) + ;; FIXME: Using `current-column' + ;; here is dubious. See comment in + ;; `TeX-evince-sync-view-1'. + (1+ (current-column)) file) "-o" (TeX-active-master (TeX-output-extension)))))) - (when (string-match "Page:\\([0-9]+\\)" synctex-output) + (when (string-match "^Page:\\([0-9]+\\)" synctex-output) (match-string 1 synctex-output)))) (defun TeX-synctex-output-page () --=-=-=--