From unknown Sat Sep 20 02:11:12 2025 X-Loop: help-debbugs@gnu.org Subject: bug#26010: Indenting in tabulars and \& Resent-From: Arash Esbati Original-Sender: "Debbugs-submit" Resent-CC: bug-auctex@gnu.org Resent-Date: Tue, 07 Mar 2017 13:26:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 26010 X-GNU-PR-Package: auctex X-GNU-PR-Keywords: To: 26010@debbugs.gnu.org X-Debbugs-Original-To: auctex-bugs Received: via spool by submit@debbugs.gnu.org id=B.14888931021836 (code B ref -1); Tue, 07 Mar 2017 13:26:01 +0000 Received: (at submit) by debbugs.gnu.org; 7 Mar 2017 13:25:02 +0000 Received: from localhost ([127.0.0.1]:43728 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1clF6s-0000TX-9D for submit@debbugs.gnu.org; Tue, 07 Mar 2017 08:25:02 -0500 Received: from eggs.gnu.org ([208.118.235.92]:37570) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1clF6q-0000T7-Qu for submit@debbugs.gnu.org; Tue, 07 Mar 2017 08:25:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1clF6h-0007hw-Gm for submit@debbugs.gnu.org; Tue, 07 Mar 2017 08:24:55 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=BAYES_40,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:35732) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1clF6h-0007hn-Dr for submit@debbugs.gnu.org; Tue, 07 Mar 2017 08:24:51 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56725) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1clF6g-0008UL-Af for bug-auctex@gnu.org; Tue, 07 Mar 2017 08:24:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1clF6d-0007ex-3F for bug-auctex@gnu.org; Tue, 07 Mar 2017 08:24:50 -0500 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:37080) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1clF6c-0007er-W3 for bug-auctex@gnu.org; Tue, 07 Mar 2017 08:24:47 -0500 Received: from p54ace422.dip0.t-ipconnect.de ([84.172.228.34]:51673 helo=MUTANT) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.82) (envelope-from ) id 1clF6c-0007zA-GM for bug-auctex@gnu.org; Tue, 07 Mar 2017 08:24:46 -0500 From: Arash Esbati Date: Tue, 07 Mar 2017 14:24:15 +0100 Message-ID: <86a88xmd8g.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 MIME-Version: 1.0 Content-Type: text/plain 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 all, please consider the following 2 examples and how they are filled: First example works as expected, second one not because of \&: --8<---------------cut here---------------start------------->8--- \documentclass{article} \usepackage{longtable} \begin{document} Hit `C-c C-q C-e' inside env: \begin{tabular}{ll} These lines will & appear \\ at the end & of the table \end{tabular} results in: \begin{tabular}{ll} These lines will & appear \\ at the end & of the table \end{tabular} Hit `C-c C-q C-e' inside env: \begin{tabular}{ll} These lines will appear \& at the end \\ of the & table \end{tabular} results in: \begin{tabular}{ll} These lines will appear \& at the end \\ of the & table \end{tabular} \end{document} --8<---------------cut here---------------end--------------->8--- AUCTeX doesn't see the control symbol \&, it just takes the ampersand as a column separator. This issue is caused in the last part of the function `LaTeX-indent-tabular': --8<---------------cut here---------------start------------->8--- (cond (... (t (+ 2 (let ((any-col (save-excursion (when (re-search-backward "\\\\\\\\\\|&" beg-pos t) (current-column))))) (if (and any-col (string= "&" (match-string 0))) any-col beg-col))))))) --8<---------------cut here---------------end--------------->8--- I'm not aware of any way to fix this *only* by tweaking the regexp here: (re-search-backward "\\\\\\\\\\|&" beg-pos t) Any idea? Otherwise, I suggest the following change in `LaTeX-indent-tabular': --8<---------------cut here---------------start------------->8--- (cond (... (t (+ 2 (let ((any-col (save-excursion (when (re-search-backward "\\\\\\\\\\|[^\\]&" beg-pos t) (current-column))))) (if (and any-col (string= "&" (substring (match-string-no-properties 0) -1))) (1+ any-col) beg-col))))))) --8<---------------cut here---------------end--------------->8--- Comments welcome. Best, Arash From unknown Sat Sep 20 02:11:12 2025 X-Loop: help-debbugs@gnu.org Subject: bug#26010: Indenting in tabulars and \& References: <86a88xmd8g.fsf@gnu.org> Resent-From: Ikumi Keita Original-Sender: "Debbugs-submit" Resent-CC: bug-auctex@gnu.org Resent-Date: Tue, 07 Mar 2017 17:50:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 26010 X-GNU-PR-Package: auctex X-GNU-PR-Keywords: To: Arash Esbati Cc: 26010@debbugs.gnu.org Received: via spool by 26010-submit@debbugs.gnu.org id=B26010.14889089932487 (code B ref 26010); Tue, 07 Mar 2017 17:50:01 +0000 Received: (at 26010) by debbugs.gnu.org; 7 Mar 2017 17:49:53 +0000 Received: from localhost ([127.0.0.1]:44917 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1clJFA-0000e3-QB for submit@debbugs.gnu.org; Tue, 07 Mar 2017 12:49:52 -0500 Received: from omx22.esk.m4.zaq.ne.jp ([220.152.48.11]:33819) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1clJF8-0000do-6a for 26010@debbugs.gnu.org; Tue, 07 Mar 2017 12:49:51 -0500 Received: from omx22.esk.m4.zaq.ne.jp ([220.152.49.32] [220.152.49.32]) by omx22.esk.m4.zaq.ne.jp with ESMTP id <20170307174942882.GXRT.3119.omx22.esk.m4.zaq.ne.jp@omx22.esk.m4.zaq.ne.jp>; Wed, 8 Mar 2017 02:49:42 +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 <20170307174942832.QFFP.26886.smtpa21.esk.m4.zaq.ne.jp@smtpa21.esk.m4.zaq.ne.jp>; Wed, 8 Mar 2017 02:49:42 +0900 Received: from localhost (localhost [127.0.0.1]) by freebsd.vmware (Postfix) with ESMTP id CEE57139800; Wed, 8 Mar 2017 02:49:41 +0900 (JST) In-reply-to: Your message of "Tue, 07 Mar 2017 14:24:15 +0100." <86a88xmd8g.fsf@gnu.org> X-Mailer: MH-E 8.6; MH 6.8.4.JP-3.05; GNU Emacs 25.1.1 Date: Wed, 08 Mar 2017 02:49:41 +0900 Message-ID: <99914.1488908981@localhost> From: Ikumi Keita 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 Arash, > I'm not aware of any way to fix this *only* by tweaking the regexp here: > (re-search-backward "\\\\\\\\\\|&" beg-pos t) > Any idea? > Otherwise, I suggest the following change in `LaTeX-indent-tabular': > (cond (... > (t > (+ 2 > (let ((any-col (save-excursion > (when (re-search-backward "\\\\\\\\\\|[^\\]&" beg-pos t) > (current-column))))) > (if (and any-col (string= "&" (substring (match-string-no-properties 0) -1))) > (1+ any-col) > beg-col))))))) > Comments welcome. I think the form `(string= ...)' can be replaced with `(= ?& (char-before (match-end 0)))'. And here is another solution keeping the regexp untouched: (cond (... (t (+ 2 (let ((any-col (save-excursion (when (and (re-search-backward "\\\\\\\\\\|&" beg-pos t) (= ?& (char-after)) (not (TeX-escaped-p))) (current-column))))) (or any-col beg-col)))))))) Using `TeX-escaped-p' might be overkilling since we allow loose usages of (looking-at "\\\\\\\\") and (re-search-backward "\\\\\\\\... ) in this function. Bye, Ikumi Keita From unknown Sat Sep 20 02:11:12 2025 X-Loop: help-debbugs@gnu.org Subject: bug#26010: Indenting in tabulars and \& Resent-From: Arash Esbati Original-Sender: "Debbugs-submit" Resent-CC: bug-auctex@gnu.org Resent-Date: Tue, 07 Mar 2017 19:29:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 26010 X-GNU-PR-Package: auctex X-GNU-PR-Keywords: To: Ikumi Keita Cc: 26010@debbugs.gnu.org Received: via spool by 26010-submit@debbugs.gnu.org id=B26010.148891489712563 (code B ref 26010); Tue, 07 Mar 2017 19:29:01 +0000 Received: (at 26010) by debbugs.gnu.org; 7 Mar 2017 19:28:17 +0000 Received: from localhost ([127.0.0.1]:45001 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1clKmO-0003GY-TE for submit@debbugs.gnu.org; Tue, 07 Mar 2017 14:28:17 -0500 Received: from eggs.gnu.org ([208.118.235.92]:35662) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1clKmN-0003GM-B7 for 26010@debbugs.gnu.org; Tue, 07 Mar 2017 14:28:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1clKmF-0001wT-2z for 26010@debbugs.gnu.org; Tue, 07 Mar 2017 14:28:10 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.5 required=5.0 tests=BAYES_05,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:42232) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1clKmE-0001vX-Vn; Tue, 07 Mar 2017 14:28:07 -0500 Received: from p54ace422.dip0.t-ipconnect.de ([84.172.228.34]:53074 helo=MUTANT) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.82) (envelope-from ) id 1clKmE-0006T1-De; Tue, 07 Mar 2017 14:28:06 -0500 From: Arash Esbati References: <99914.1488908981@localhost> Date: Tue, 07 Mar 2017 20:27:46 +0100 In-Reply-To: <99914.1488908981@localhost> (Ikumi Keita's message of "Wed, 08 Mar 2017 02:49:41 +0900") Message-ID: <86y3wg51l9.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 MIME-Version: 1.0 Content-Type: text/plain 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 (-----) Ikumi Keita writes: >> Otherwise, I suggest the following change in `LaTeX-indent-tabular': >> (cond (... >> (t >> (+ 2 >> (let ((any-col (save-excursion >> (when (re-search-backward "\\\\\\\\\\|[^\\]&" beg-pos t) >> (current-column))))) >> (if (and any-col (string= "&" (substring (match-string-no-properties 0) -1))) >> (1+ any-col) >> beg-col))))))) >> Comments welcome. Hi Keita, many thanks for checking and your response. > I think the form `(string= ...)' can be replaced with > `(= ?& (char-before (match-end 0)))'. Yes, this is even more elegant. > And here is another solution keeping the regexp untouched: > (cond (... > (t > (+ 2 > (let ((any-col (save-excursion > (when (and > (re-search-backward "\\\\\\\\\\|&" beg-pos t) > (= ?& (char-after)) > (not (TeX-escaped-p))) > (current-column))))) > (or any-col > beg-col)))))))) > > Using `TeX-escaped-p' might be overkilling since we allow loose usages of > (looking-at "\\\\\\\\") and (re-search-backward "\\\\\\\\... ) in this > function. I agree, this seems overkill. `[^\\]' is also used in `LaTeX-hanging-ampersand-position' which is right above `LaTeX-indent-tabular' in latex. el -- these functions would look more in line with `[^\\]' in regexp. This is the current suggestion: (cond (... (t (+ 2 (let ((any-col (save-excursion (when (re-search-backward "\\\\\\\\\\|[^\\]&" beg-pos t) (current-column))))) (if (and any-col (= ?& (char-before (match-end 0))) (1+ any-col) beg-col))))))) Best, Arash From unknown Sat Sep 20 02:11:12 2025 X-Loop: help-debbugs@gnu.org Subject: bug#26010: Indenting in tabulars and \& Resent-From: =?UTF-8?Q?Mos=C3=A8?= Giordano Original-Sender: "Debbugs-submit" Resent-CC: bug-auctex@gnu.org Resent-Date: Tue, 07 Mar 2017 20:28:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 26010 X-GNU-PR-Package: auctex X-GNU-PR-Keywords: To: Arash Esbati Cc: 26010@debbugs.gnu.org Received: via spool by 26010-submit@debbugs.gnu.org id=B26010.148891846318315 (code B ref 26010); Tue, 07 Mar 2017 20:28:02 +0000 Received: (at 26010) by debbugs.gnu.org; 7 Mar 2017 20:27:43 +0000 Received: from localhost ([127.0.0.1]:45057 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1clLhv-0004lK-BS for submit@debbugs.gnu.org; Tue, 07 Mar 2017 15:27:43 -0500 Received: from eggs.gnu.org ([208.118.235.92]:54380) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1clLht-0004l8-Vt for 26010@debbugs.gnu.org; Tue, 07 Mar 2017 15:27:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1clLhk-0000tg-Rl for 26010@debbugs.gnu.org; Tue, 07 Mar 2017 15:27:36 -0500 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]:43131) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1clLhk-0000tc-PD for 26010@debbugs.gnu.org; Tue, 07 Mar 2017 15:27:32 -0500 Received: from mail-oi0-f49.google.com ([209.85.218.49]:33867) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1clLhk-0005h4-By for 26010@debbugs.gnu.org; Tue, 07 Mar 2017 15:27:32 -0500 Received: by mail-oi0-f49.google.com with SMTP id m124so8568173oig.1 for <26010@debbugs.gnu.org>; Tue, 07 Mar 2017 12:27:32 -0800 (PST) X-Gm-Message-State: AMke39n4A2N2Sx2KkCXp+1RkCpI6Nf7U5oL5AvsgNntAnuvK3vL+BbknqXlJoFtoPLltg+2XqNkrtu/YRuhJ9Q== X-Received: by 10.202.244.135 with SMTP id s129mr1330819oih.207.1488918451297; Tue, 07 Mar 2017 12:27:31 -0800 (PST) MIME-Version: 1.0 Received: by 10.157.17.82 with HTTP; Tue, 7 Mar 2017 12:26:50 -0800 (PST) In-Reply-To: <86a88xmd8g.fsf@gnu.org> References: <86a88xmd8g.fsf@gnu.org> From: =?UTF-8?Q?Mos=C3=A8?= Giordano Date: Tue, 7 Mar 2017 21:26:50 +0100 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 Arash, 2017-03-07 14:24 GMT+01:00 Arash Esbati : > AUCTeX doesn't see the control symbol \&, it just takes the ampersand as > a column separator. This issue is caused in the last part of the > function `LaTeX-indent-tabular': Good catch. I like the solution proposed by Keita, with or without `TeX-escaped-p' (but I slightly prefer using these generic functions). If you're going to install the fix, please add a test as well. Bye, Mos=C3=A8 From unknown Sat Sep 20 02:11:12 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#26010: closed (Re: bug#26010: Indenting in tabulars and \&) Message-ID: References: <86o9xct5bv.fsf@gnu.org> <86a88xmd8g.fsf@gnu.org> X-Gnu-PR-Message: they-closed 26010 X-Gnu-PR-Package: auctex Reply-To: 26010@debbugs.gnu.org Date: Wed, 08 Mar 2017 10:47:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1488970022-7602-1" This is a multi-part message in MIME format... ------------=_1488970022-7602-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #26010: Indenting in tabulars and \& 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 26010@debbugs.gnu.org. --=20 26010: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D26010 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1488970022-7602-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 26010-close) by debbugs.gnu.org; 8 Mar 2017 10:46:10 +0000 Received: from localhost ([127.0.0.1]:45402 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1clZ6g-0001xT-1i for submit@debbugs.gnu.org; Wed, 08 Mar 2017 05:46:10 -0500 Received: from eggs.gnu.org ([208.118.235.92]:44733) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1clZ6e-0001xA-2O for 26010-close@debbugs.gnu.org; Wed, 08 Mar 2017 05:46:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1clZ6U-0001P0-N5 for 26010-close@debbugs.gnu.org; Wed, 08 Mar 2017 05:46:02 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.5 required=5.0 tests=BAYES_05,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:54865) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1clZ6U-0001Oo-Ig for 26010-close@debbugs.gnu.org; Wed, 08 Mar 2017 05:45:58 -0500 Received: from p54ace8a8.dip0.t-ipconnect.de ([84.172.232.168]:54957 helo=MUTANT) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.82) (envelope-from ) id 1clZ6T-0006rl-JR; Wed, 08 Mar 2017 05:45:58 -0500 From: Arash Esbati To: =?iso-8859-1?Q?Mos=E8?= Giordano Subject: Re: bug#26010: Indenting in tabulars and \& References: <86a88xmd8g.fsf@gnu.org> Date: Wed, 08 Mar 2017 11:45:24 +0100 In-Reply-To: (=?iso-8859-1?Q?=22Mos=E8?= Giordano"'s message of "Tue, 7 Mar 2017 21:26:50 +0100") Message-ID: <86o9xct5bv.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 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: 26010-close Cc: 26010-close@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 (-----) Mos=E8 Giordano writes: > 2017-03-07 14:24 GMT+01:00 Arash Esbati : >> AUCTeX doesn't see the control symbol \&, it just takes the ampersand as >> a column separator. This issue is caused in the last part of the >> function `LaTeX-indent-tabular': > > Good catch. I like the solution proposed by Keita, with or without > `TeX-escaped-p' (but I slightly prefer using these generic functions). > If you're going to install the fix, please add a test as well. Hi Mos=E8, thanks for your response. I've installed a patch incl. a test; I went for Keita's suggestion without `TeX-escaped-p', commit 991b582. I close this one then. Best, Arash ------------=_1488970022-7602-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 7 Mar 2017 13:25:02 +0000 Received: from localhost ([127.0.0.1]:43728 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1clF6s-0000TX-9D for submit@debbugs.gnu.org; Tue, 07 Mar 2017 08:25:02 -0500 Received: from eggs.gnu.org ([208.118.235.92]:37570) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1clF6q-0000T7-Qu for submit@debbugs.gnu.org; Tue, 07 Mar 2017 08:25:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1clF6h-0007hw-Gm for submit@debbugs.gnu.org; Tue, 07 Mar 2017 08:24:55 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=BAYES_40,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:35732) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1clF6h-0007hn-Dr for submit@debbugs.gnu.org; Tue, 07 Mar 2017 08:24:51 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56725) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1clF6g-0008UL-Af for bug-auctex@gnu.org; Tue, 07 Mar 2017 08:24:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1clF6d-0007ex-3F for bug-auctex@gnu.org; Tue, 07 Mar 2017 08:24:50 -0500 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:37080) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1clF6c-0007er-W3 for bug-auctex@gnu.org; Tue, 07 Mar 2017 08:24:47 -0500 Received: from p54ace422.dip0.t-ipconnect.de ([84.172.228.34]:51673 helo=MUTANT) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.82) (envelope-from ) id 1clF6c-0007zA-GM for bug-auctex@gnu.org; Tue, 07 Mar 2017 08:24:46 -0500 From: Arash Esbati To: auctex-bugs Subject: Indenting in tabulars and \& Date: Tue, 07 Mar 2017 14:24:15 +0100 Message-ID: <86a88xmd8g.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 MIME-Version: 1.0 Content-Type: text/plain 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 all, please consider the following 2 examples and how they are filled: First example works as expected, second one not because of \&: --8<---------------cut here---------------start------------->8--- \documentclass{article} \usepackage{longtable} \begin{document} Hit `C-c C-q C-e' inside env: \begin{tabular}{ll} These lines will & appear \\ at the end & of the table \end{tabular} results in: \begin{tabular}{ll} These lines will & appear \\ at the end & of the table \end{tabular} Hit `C-c C-q C-e' inside env: \begin{tabular}{ll} These lines will appear \& at the end \\ of the & table \end{tabular} results in: \begin{tabular}{ll} These lines will appear \& at the end \\ of the & table \end{tabular} \end{document} --8<---------------cut here---------------end--------------->8--- AUCTeX doesn't see the control symbol \&, it just takes the ampersand as a column separator. This issue is caused in the last part of the function `LaTeX-indent-tabular': --8<---------------cut here---------------start------------->8--- (cond (... (t (+ 2 (let ((any-col (save-excursion (when (re-search-backward "\\\\\\\\\\|&" beg-pos t) (current-column))))) (if (and any-col (string= "&" (match-string 0))) any-col beg-col))))))) --8<---------------cut here---------------end--------------->8--- I'm not aware of any way to fix this *only* by tweaking the regexp here: (re-search-backward "\\\\\\\\\\|&" beg-pos t) Any idea? Otherwise, I suggest the following change in `LaTeX-indent-tabular': --8<---------------cut here---------------start------------->8--- (cond (... (t (+ 2 (let ((any-col (save-excursion (when (re-search-backward "\\\\\\\\\\|[^\\]&" beg-pos t) (current-column))))) (if (and any-col (string= "&" (substring (match-string-no-properties 0) -1))) (1+ any-col) beg-col))))))) --8<---------------cut here---------------end--------------->8--- Comments welcome. Best, Arash ------------=_1488970022-7602-1--