From unknown Thu Aug 14 22:23:51 2025 X-Loop: help-debbugs@gnu.org Subject: bug#63441: Wrong Indentation with backslash in verb macros with braces Resent-From: Arash Esbati Original-Sender: "Debbugs-submit" Resent-CC: bug-auctex@gnu.org Resent-Date: Thu, 11 May 2023 08:37:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 63441 X-GNU-PR-Package: auctex X-GNU-PR-Keywords: To: 63441@debbugs.gnu.org X-Debbugs-Original-To: auctex-bugs Received: via spool by submit@debbugs.gnu.org id=B.168379418525222 (code B ref -1); Thu, 11 May 2023 08:37:02 +0000 Received: (at submit) by debbugs.gnu.org; 11 May 2023 08:36:25 +0000 Received: from localhost ([127.0.0.1]:49679 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1px1mi-0006Yj-JT for submit@debbugs.gnu.org; Thu, 11 May 2023 04:36:24 -0400 Received: from lists.gnu.org ([209.51.188.17]:60158) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1px1mg-0006Yc-VB for submit@debbugs.gnu.org; Thu, 11 May 2023 04:36:24 -0400 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 1px1mg-0003S4-Q5 for bug-auctex@gnu.org; Thu, 11 May 2023 04:36:22 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1px1mg-0007bS-Gi for bug-auctex@gnu.org; Thu, 11 May 2023 04:36:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:Subject:To:From:in-reply-to: references; bh=AUMECagijXLMr62FZ3GnSrxq40aLxPkQK2G9VHVpwcs=; b=Ui1O3AKyQRHx4S YZkwhkcduyPuDZWdn2q6ol9QI9rMxskhtOCZ3iQMpWHAeBp8V0in3c7LWM+dzLM/t7jTu1WKeoMOn d+dv53mMPGMp10ExxbapYZKY5u0P/2no8BYt2SWvGB+UcF22SSRDqrr9qkF0LIAFAtHkpzWa4xb9h v8wuwXNIYDya70bG1SaUPQJ6rdn6SPu+S2N2cQ791VdS9wpSvKxvssfobi1YIUOUwum0wphTGIyvH +/RffcbcpNpceYx/QX8rw2ev973b1v4dsqUZFKlp1kSOqu5Kf+7/rtEHUYru0j0U9FjUg5yVQeTEy 9AO89ndHn2YxbEDEt44g==; Received: from p5b326c3d.dip0.t-ipconnect.de ([91.50.108.61] helo=MUTANT) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1px1mf-0005eW-Bq for bug-auctex@gnu.org; Thu, 11 May 2023 04:36:22 -0400 From: Arash Esbati Date: Thu, 11 May 2023 10:36:06 +0200 Message-ID: <86ilczcljd.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) 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: -3.3 (---) Hi all, I just installed a change (commit 0cb158fd96) which improves fontification of arguments of verb macros with braces. One addition is also handling of backslash(es) as last character(s) in the argument. There is a downside, though. Consider the following file: --8<---------------cut here---------------start------------->8--- \documentclass{article} \usepackage{url} \begin{document} This is text with \textbf{foo\} bar} \path{foobar\} next line \end{document} %%% Local Variables: %%% mode: latex %%% TeX-master: t %%% End: --8<---------------cut here---------------end--------------->8--- Now mark the text body and indent with 'M-x indent-region RET' or with C-M-\ and you get: --8<---------------cut here---------------start------------->8--- This is text with \textbf{foo\} bar} \path{foobar\} next line --8<---------------cut here---------------end--------------->8--- which is wrong. This is due to the implementation of `TeX-brace-count-line' which presumes that ?\\ always escapes the next char, which is wrong in verb macros. I can think of a solution like this: --8<---------------cut here---------------start------------->8--- diff --git a/tex.el b/tex.el index b862d3c2..4663b217 100644 --- a/tex.el +++ b/tex.el @@ -5485,7 +5485,9 @@ additional characters." (setq count (- count TeX-brace-indent-level))) ((eq char ?\\) (when (< (point) limit) - (forward-char) + (unless (and (fboundp 'LaTeX-verbatim-p) + (LaTeX-verbatim-p)) + (forward-char)) t)))))) count))) --8<---------------cut here---------------end--------------->8--- Any comments oder better approaches? Best, Arash From unknown Thu Aug 14 22:23:51 2025 X-Loop: help-debbugs@gnu.org Subject: bug#63441: Wrong Indentation with backslash in verb macros with braces Resent-From: Ikumi Keita Original-Sender: "Debbugs-submit" Resent-CC: bug-auctex@gnu.org Resent-Date: Thu, 11 May 2023 13:48:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63441 X-GNU-PR-Package: auctex X-GNU-PR-Keywords: To: Arash Esbati Cc: 63441@debbugs.gnu.org Received: via spool by 63441-submit@debbugs.gnu.org id=B63441.16838128291719 (code B ref 63441); Thu, 11 May 2023 13:48:01 +0000 Received: (at 63441) by debbugs.gnu.org; 11 May 2023 13:47:09 +0000 Received: from localhost ([127.0.0.1]:50099 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1px6dQ-0000Rf-P5 for submit@debbugs.gnu.org; Thu, 11 May 2023 09:47:09 -0400 Received: from smtp1a.inetd.co.jp ([210.129.88.11]:54126) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1px6dO-0000RU-ED for 63441@debbugs.gnu.org; Thu, 11 May 2023 09:47:07 -0400 Received: from localhost (42-144-46-173.rev.home.ne.jp [42.144.46.173]) by smtp1a.inetd.co.jp (Postfix) with ESMTPA id 4DA1F5F; Thu, 11 May 2023 22:47:04 +0900 (JST) From: Ikumi Keita In-reply-to: <86ilczcljd.fsf@gnu.org> References: <86ilczcljd.fsf@gnu.org> Comments: In-reply-to Arash Esbati message dated "Thu, 11 May 2023 10:36:06 +0200." X-Mailer: MH-E 8.6+git; nmh 1.7.1; GNU Emacs 28.2 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <97695.1683812821.1@localhost> Date: Thu, 11 May 2023 22:47:01 +0900 Message-ID: <97697.1683812821@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: -1.0 (-) Hi Arash, >>>>> Arash Esbati writes: > which is wrong. This is due to the implementation of > `TeX-brace-count-line' which presumes that ?\\ always escapes the next > char, which is wrong in verb macros. I can think of a solution like > this: > diff --git a/tex.el b/tex.el > index b862d3c2..4663b217 100644 > --- a/tex.el > +++ b/tex.el > @@ -5485,7 +5485,9 @@ additional characters." > (setq count (- count TeX-brace-indent-level))) > ((eq char ?\\) > (when (< (point) limit) > - (forward-char) > + (unless (and (fboundp 'LaTeX-verbatim-p) > + (LaTeX-verbatim-p)) > + (forward-char)) > t)))))) > count))) > Any comments oder better approaches? I don't think `fboundp' test is a right approach because it calls `LaTeX-verbatim-p' even in non-LaTeX mode buffers after the session loads latex.el. How about just (TeX-verbatim-p) instead of (and (fboundp 'LaTeX-verbatim-p) (LaTeX-verbatim-p)) ? Bye, Ikumi Keita #StandWithUkraine #StopWarInUkraine From unknown Thu Aug 14 22:23:51 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: Arash Esbati Subject: bug#63441: closed (Re: bug#63441: Wrong Indentation with backslash in verb macros with braces) Message-ID: References: <86lehuac4h.fsf@gnu.org> <86ilczcljd.fsf@gnu.org> X-Gnu-PR-Message: they-closed 63441 X-Gnu-PR-Package: auctex Reply-To: 63441@debbugs.gnu.org Date: Thu, 11 May 2023 19:43:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1683834182-13052-1" This is a multi-part message in MIME format... ------------=_1683834182-13052-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #63441: Wrong Indentation with backslash in verb macros with braces 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 63441@debbugs.gnu.org. --=20 63441: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D63441 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1683834182-13052-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 63441-done) by debbugs.gnu.org; 11 May 2023 19:42:50 +0000 Received: from localhost ([127.0.0.1]:53402 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pxCBe-0003O8-0I for submit@debbugs.gnu.org; Thu, 11 May 2023 15:42:50 -0400 Received: from eggs.gnu.org ([209.51.188.92]:50460) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pxCBb-0003Nu-J6 for 63441-done@debbugs.gnu.org; Thu, 11 May 2023 15:42:49 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pxCBU-00007j-Dz; Thu, 11 May 2023 15:42:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=cQUb7S9MQZz8ItlG9M70KTBW2Qxr3M4wkAcktmlXQRw=; b=nqczpKfoQh/j+ivoK0n4 siFxoX8KUVt4KVw1i5v+HYFUwwQcgRqxXQZpVG2sBCYHwdbcCyubDEvVINpPNZt/zK9iLvMEXBeZN beV/layycFnM1gJsn+3Z5XpPKrMlKc33tziLO96l02dwmadpszvkI6NQGGl4ZI+spK3p90sEHGvVe /FgLdzfvMQa/XukaPLhbxKett6ETP8+H8AKZK524lKn2HmtLXlFchiQErcd/2dJwB1imRJehcJaAt vwxHwGWeMBaN0mXC+tFkR9RapBQDzmPmLFakGXK5+nkRtpe8/hsNhms12bN5rlUmXmxF322LQgouS foMKEgG5A8djHw==; Received: from p5b326c3d.dip0.t-ipconnect.de ([91.50.108.61] helo=MUTANT) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pxCBU-0006oG-0p; Thu, 11 May 2023 15:42:40 -0400 From: Arash Esbati To: Ikumi Keita Subject: Re: bug#63441: Wrong Indentation with backslash in verb macros with braces In-Reply-To: <97697.1683812821@localhost> (Ikumi Keita's message of "Thu, 11 May 2023 22:47:01 +0900") References: <86ilczcljd.fsf@gnu.org> <97697.1683812821@localhost> Date: Thu, 11 May 2023 21:42:22 +0200 Message-ID: <86lehuac4h.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 63441-done Cc: 63441-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: -3.3 (---) Hi Keita, Ikumi Keita writes: > I don't think `fboundp' test is a right approach because it calls > `LaTeX-verbatim-p' even in non-LaTeX mode buffers after the session > loads latex.el. How about just > (TeX-verbatim-p) > instead of > (and (fboundp 'LaTeX-verbatim-p) > (LaTeX-verbatim-p)) > ? Thanks for reminding me, you're right, that's the way to go. I installed the change per your suggestion (commit 715a88a5f2). Closing this report. Best, Arash ------------=_1683834182-13052-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 11 May 2023 08:36:25 +0000 Received: from localhost ([127.0.0.1]:49679 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1px1mi-0006Yj-JT for submit@debbugs.gnu.org; Thu, 11 May 2023 04:36:24 -0400 Received: from lists.gnu.org ([209.51.188.17]:60158) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1px1mg-0006Yc-VB for submit@debbugs.gnu.org; Thu, 11 May 2023 04:36:24 -0400 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 1px1mg-0003S4-Q5 for bug-auctex@gnu.org; Thu, 11 May 2023 04:36:22 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1px1mg-0007bS-Gi for bug-auctex@gnu.org; Thu, 11 May 2023 04:36:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:Subject:To:From:in-reply-to: references; bh=AUMECagijXLMr62FZ3GnSrxq40aLxPkQK2G9VHVpwcs=; b=Ui1O3AKyQRHx4S YZkwhkcduyPuDZWdn2q6ol9QI9rMxskhtOCZ3iQMpWHAeBp8V0in3c7LWM+dzLM/t7jTu1WKeoMOn d+dv53mMPGMp10ExxbapYZKY5u0P/2no8BYt2SWvGB+UcF22SSRDqrr9qkF0LIAFAtHkpzWa4xb9h v8wuwXNIYDya70bG1SaUPQJ6rdn6SPu+S2N2cQ791VdS9wpSvKxvssfobi1YIUOUwum0wphTGIyvH +/RffcbcpNpceYx/QX8rw2ev973b1v4dsqUZFKlp1kSOqu5Kf+7/rtEHUYru0j0U9FjUg5yVQeTEy 9AO89ndHn2YxbEDEt44g==; Received: from p5b326c3d.dip0.t-ipconnect.de ([91.50.108.61] helo=MUTANT) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1px1mf-0005eW-Bq for bug-auctex@gnu.org; Thu, 11 May 2023 04:36:22 -0400 From: Arash Esbati To: auctex-bugs Subject: Wrong Indentation with backslash in verb macros with braces Date: Thu, 11 May 2023 10:36:06 +0200 Message-ID: <86ilczcljd.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) 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: -3.3 (---) Hi all, I just installed a change (commit 0cb158fd96) which improves fontification of arguments of verb macros with braces. One addition is also handling of backslash(es) as last character(s) in the argument. There is a downside, though. Consider the following file: --8<---------------cut here---------------start------------->8--- \documentclass{article} \usepackage{url} \begin{document} This is text with \textbf{foo\} bar} \path{foobar\} next line \end{document} %%% Local Variables: %%% mode: latex %%% TeX-master: t %%% End: --8<---------------cut here---------------end--------------->8--- Now mark the text body and indent with 'M-x indent-region RET' or with C-M-\ and you get: --8<---------------cut here---------------start------------->8--- This is text with \textbf{foo\} bar} \path{foobar\} next line --8<---------------cut here---------------end--------------->8--- which is wrong. This is due to the implementation of `TeX-brace-count-line' which presumes that ?\\ always escapes the next char, which is wrong in verb macros. I can think of a solution like this: --8<---------------cut here---------------start------------->8--- diff --git a/tex.el b/tex.el index b862d3c2..4663b217 100644 --- a/tex.el +++ b/tex.el @@ -5485,7 +5485,9 @@ additional characters." (setq count (- count TeX-brace-indent-level))) ((eq char ?\\) (when (< (point) limit) - (forward-char) + (unless (and (fboundp 'LaTeX-verbatim-p) + (LaTeX-verbatim-p)) + (forward-char)) t)))))) count))) --8<---------------cut here---------------end--------------->8--- Any comments oder better approaches? Best, Arash ------------=_1683834182-13052-1--