From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#71364: Fix Table.el export Date: Sat, 08 Jun 2024 09:38:44 +0300 Message-ID: <86le3gdjm3.fsf@gnu.org> References: <8734ptj6lj.fsf@gmail.com> <86r0dagv7v.fsf@gnu.org> <87frtpqltu.fsf@gmail.com> <86jzj1f2fb.fsf@gnu.org> <87h6e4jiav.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27561"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 71364@debbugs.gnu.org To: Pranshu , Reuben Thomas , Vladimir Nikishkin Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jun 08 08:40:16 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sFpkN-0006uT-Ln for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 08 Jun 2024 08:40:15 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sFpjx-0006F3-Fb; Sat, 08 Jun 2024 02:39:49 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sFpjv-0006EW-TP for bug-gnu-emacs@gnu.org; Sat, 08 Jun 2024 02:39:47 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sFpjv-000690-IL for bug-gnu-emacs@gnu.org; Sat, 08 Jun 2024 02:39:47 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sFpkA-00009p-MX for bug-gnu-emacs@gnu.org; Sat, 08 Jun 2024 02:40:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 08 Jun 2024 06:40:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71364 X-GNU-PR-Package: emacs Original-Received: via spool by 71364-submit@debbugs.gnu.org id=B71364.1717828755471 (code B ref 71364); Sat, 08 Jun 2024 06:40:02 +0000 Original-Received: (at 71364) by debbugs.gnu.org; 8 Jun 2024 06:39:15 +0000 Original-Received: from localhost ([127.0.0.1]:48864 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sFpjP-00007X-1x for submit@debbugs.gnu.org; Sat, 08 Jun 2024 02:39:15 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:36766) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sFpjM-000076-Hb for 71364@debbugs.gnu.org; Sat, 08 Jun 2024 02:39:13 -0400 Original-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 1sFpj1-000668-5G; Sat, 08 Jun 2024 02:38:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=a9BlbQhIXi7bHAMMCukFlv1rETlvPXxUPCy+R3Lo+iQ=; b=nwFOrmPjF81cVCKcmXgL eIc2SCC/YTbxS6Jywl8/azQCnAIhzFh27M3sv59h3rc/UT6g1ZzXBP1HYfthRjnZQ5yRFBxVDA2x7 JdE9CwRbMiiFhCuNg27YR3on7mgs7O1xDy9Er3ke7c9fy8xtY+al6u1hueMB9cff2bX8HSmab5pNp j0H8xIUk8JciX+uMHxtxEJX7WJ6ipjTqLLDsdTLi4atJgZkMWI2tZlZnppQ9rME8aZQVgW96G6Uh8 0IZyqp7GHQXCa2AiGkJMHX/tAM1qShPtcXxWbf8C3R1l8XU4mYQY1C0q2gtAy7fOKs0Oih/k9TQ07 f8StxQjx0+oUFg==; In-Reply-To: <87h6e4jiav.fsf@gmail.com> (message from Pranshu on Sat, 08 Jun 2024 12:10:32 +1000) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:286812 Archived-At: > From: Pranshu > Cc: 71364@debbugs.gnu.org > Date: Sat, 08 Jun 2024 12:10:32 +1000 > > > So you are saying that exporting to latex is basically completely > > broken in the current code? Is that command use to export only to > > latex, or is the fact that the export is to latex is just one of the > > possibilities? > > Yes. The function that does the escaping is > `table--generate-source-scan-lines', which is a misleading name because > it is only called by table-generate-source when the language is exported > to latex. It is strange to hear that this is so basically broken. This code exists since more than 20 years ago, and several people contributed changes to the LaTeX export, so I'd expect it to be at least somewhat useful and working. > >> What the diff does, is that it adds a variable that allows the user to > >> change what will be escaped. Also as you can see in the above latex > >> table, the backslash had to be escaped in a different way, so using one > >> regexp variable would not be enough. That is why the solution contains > >> a variable called 'table-source-latex-escape-characters', which is a > >> cons cell with the documentation: > > > > Why would a user need to customize this on the level of characters? > > Shouldn't there be a single boolean that causes latex-specific > > characters to be escape or not to be escaped, all of them or none? > > > > The problem with that is that there are latex charecters such as '%', > which is comment, that will cause the whole table to break of not > escaped. Is % the only character with such problems, or are there others? > And since the variable is a regexp, it can possibly escape macros, such > as 'LaTeX' -> '\LaTeX'. Not sure I understand: is it a Good Thing that it could escape macros, or is it a Bad Thing (which should be avoided)? More generally, given these tricky considerations, how would a user determine which characters to include in the regexp? If it's only by examining the texts in the table cells, then it could be not very practical, since a table could be very large. > >> A cons cell containing which charecters to escape in the latex source > >> of ‘table-generate-source’. The head of the list, if non-nil contains a > >> regexp that matches all text that is to be adding a preceding backslash > >> to the matching text. If nil, no non-backslash charecters will be > >> escaped. The tail, if non-nil, escapes all the backslashes in the latex > >> source. > > > > What is the purpose of the "tail", i.e. why would a user want to > > escape all the backslashes? > > Mainly because some people might only use the latex export to turn their > table into a pdf, and escaping backslashes is not as simple as typing > two backslashes. And also since it was the default behaviour, so those > who have already made tables will not need to escape all those > backslashes to make their documents exportable. > > If you feel that is unnecessary, I can modify the diff not include > backslash escaping. I think it should be controlled by a separate variable. I also added to the discussion two people who in the past contributed changes to table.el in the LaTeX-related areas, so they probably have some experience with exporting to LaTeX, and could help us figure out how best to handle this issue. Reuben and Vladimir, would you please comment on the usability of exporting to LaTeX in table.el, and on the proposed improvements? Thanks.