unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#71364: Fix Table.el export
@ 2024-06-04 11:22 Pranshu
  2024-06-06 11:35 ` Eli Zaretskii
  0 siblings, 1 reply; 17+ messages in thread
From: Pranshu @ 2024-06-04 11:22 UTC (permalink / raw)
  To: pranshusharma366; +Cc: 71364

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: table.diff --]
[-- Type: text/x-diff, Size: 3649 bytes --]

diff --git a/lisp/textmodes/table.el b/lisp/textmodes/table.el
index 19c6a8d7c4..28401084a6 100644
--- a/lisp/textmodes/table.el
+++ b/lisp/textmodes/table.el
@@ -697,6 +697,19 @@ table-word-continuation-char
   :type 'character
   :group 'table)
 
+(defcustom table-source-latex-escape-characters (cons "[#$~_^%{}&]" t)
+  "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."
+  :tag "Source Latex Escape Charecters Regexp"
+  :type '(cons (radio (regexp :tag "regexp")
+                        (const :tag "Off" nil))
+               boolean)
+  :group 'table)
+
 (defcustom table-detect-cell-alignment t
   "Detect cell contents alignment automatically.
 When non-nil cell alignment is automatically determined by the
@@ -3264,19 +3277,29 @@ table--generate-source-scan-lines
                   (lambda (from to)
                     (let ((line (table--buffer-substring-and-trim
                                  (table--goto-coordinate (cons from y))
-                                 (table--goto-coordinate (cons to y)))))
+                                 (table--goto-coordinate (cons to y))))
+                          (escape-char-reg
+                           (apply 'concat (append (and (car table-source-latex-escape-characters)
+                                               (list "\\("
+                                                     (car table-source-latex-escape-characters)
+                                                     "\\)"
+                                                     (and (cdr table-source-latex-escape-characters)
+                                                          "\\|")))
+                                   (and (cdr table-source-latex-escape-characters)
+                                        (list"\\(\\\\\\)"))))))
                       ;; escape special characters
                       (with-temp-buffer
                         (insert line)
                         (goto-char (point-min))
-                        (while (re-search-forward "\\([#$~_^%{}&]\\)\\|\\(\\\\\\)\\|\\([<>|]\\)" nil t)
-                          (if (match-beginning 1)
-                              (save-excursion
-                                (goto-char (match-beginning 1))
-                                (insert  "\\"))
-                            (if (match-beginning 2)
-                                (replace-match "$\\backslash$" t t)
-                              (replace-match (concat "$" (match-string 3) "$")) t t)))
+                        (when (or (car table-source-latex-escape-characters)
+                                  (cdr table-source-latex-escape-characters))
+                          (while (re-search-forward escape-char-reg nil t)
+                            (if (and (car table-source-latex-escape-characters)
+                                     (match-beginning 1))
+                                    (save-excursion
+                                      (goto-char (match-beginning 1))
+                                      (insert  "\\"))
+                              (replace-match "$\\backslash$" t t))))
                         (setq line (buffer-substring (point-min) (point-max))))
                       ;; insert a column separator and column/multicolumn contents
                       (with-current-buffer dest-buffer

[-- Attachment #2: Type: text/plain, Size: 262 bytes --]


Hello all,

When table.el exports to latex, charecters like '$' are all escaped.
This makes table.el tables practically useless for any sorts of latex
export.

Attached is a diff that adds a variable that controls what should be
escaped.

Kind Regards,
Pranshu

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* bug#71364: Fix Table.el export
  2024-06-04 11:22 bug#71364: Fix Table.el export Pranshu
@ 2024-06-06 11:35 ` Eli Zaretskii
  2024-06-07  7:00   ` Pranshu
  0 siblings, 1 reply; 17+ messages in thread
From: Eli Zaretskii @ 2024-06-06 11:35 UTC (permalink / raw)
  To: Pranshu; +Cc: 71364

> Cc: 71364@debbugs.gnu.org
> From: Pranshu <pranshusharma366@gmail.com>
> Date: Tue, 04 Jun 2024 21:22:00 +1000
> 
> When table.el exports to latex, charecters like '$' are all escaped.
> This makes table.el tables practically useless for any sorts of latex
> export.
> 
> Attached is a diff that adds a variable that controls what should be
> escaped.

Could you please explain in some more details the problem and the
solution?  I'm afraid I couldn't follow your logic, perhaps because
I'm not a frequent user of LaTeX.

Thanks.





^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#71364: Fix Table.el export
  2024-06-06 11:35 ` Eli Zaretskii
@ 2024-06-07  7:00   ` Pranshu
  2024-06-07 10:54     ` Eli Zaretskii
  0 siblings, 1 reply; 17+ messages in thread
From: Pranshu @ 2024-06-07  7:00 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 71364



[1. application/pdf; thing.pdf]...


All good, basiclly in latex a equation is formatted in something like:
$\Delta Q = r^2$
Will become something like: "ΔQ = r²"

The key takeway is the dollar symbol is needed to tell the latex
compiler that it is typesetting maths.

Now, the problem is if you have a table like the following:
+---------+-------+--------+
|$\delta$ |x      |y       |
+---------+-------+--------+
|x        | $x^2$ |$xy$    |
+---------+-------+--------+
|y        | $xy$  | $y^2$  |
+---------+-------+--------+

Now if you export to latex using "C-^" or M-x table-generate-source you
get:

% This LaTeX table template is generated by emacs 30.0.50
\begin{tabular}{|l|l|l|}
\hline
\$$\backslash$delta\$ & x & y \\
\hline
x & \$x\^2\$ & \$xy\$ \\
\hline
y & \$xy\$ & \$y\^2\$ \\
\hline
\end{tabular}

The problem with this is that since the all the dollar and caret signs
are all escaped, the maths will not render.  The rendered pdf from the
above latex is attached, you can see that the equations were not
rendered properly.  This is because the dollar signs and carets were
automaticly escaped

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:

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.

Kind Regards
Pranshu

Eli Zaretskii <eliz@gnu.org> writes:

>> Cc: 71364@debbugs.gnu.org
>> From: Pranshu <pranshusharma366@gmail.com>
>> Date: Tue, 04 Jun 2024 21:22:00 +1000
>> 
>> When table.el exports to latex, charecters like '$' are all escaped.
>> This makes table.el tables practically useless for any sorts of latex
>> export.
>> 
>> Attached is a diff that adds a variable that controls what should be
>> escaped.
>
> Could you please explain in some more details the problem and the
> solution?  I'm afraid I couldn't follow your logic, perhaps because
> I'm not a frequent user of LaTeX.
>
> Thanks.





^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#71364: Fix Table.el export
  2024-06-07  7:00   ` Pranshu
@ 2024-06-07 10:54     ` Eli Zaretskii
  2024-06-08  2:10       ` Pranshu
  0 siblings, 1 reply; 17+ messages in thread
From: Eli Zaretskii @ 2024-06-07 10:54 UTC (permalink / raw)
  To: Pranshu; +Cc: 71364

> From: Pranshu <pranshusharma366@gmail.com>
> Cc: 71364@debbugs.gnu.org
> Date: Fri, 07 Jun 2024 17:00:13 +1000
> 
> Now, the problem is if you have a table like the following:
> +---------+-------+--------+
> |$\delta$ |x      |y       |
> +---------+-------+--------+
> |x        | $x^2$ |$xy$    |
> +---------+-------+--------+
> |y        | $xy$  | $y^2$  |
> +---------+-------+--------+
> 
> Now if you export to latex using "C-^" or M-x table-generate-source you
> get:
> 
> % This LaTeX table template is generated by emacs 30.0.50
> \begin{tabular}{|l|l|l|}
> \hline
> \$$\backslash$delta\$ & x & y \\
> \hline
> x & \$x\^2\$ & \$xy\$ \\
> \hline
> y & \$xy\$ & \$y\^2\$ \\
> \hline
> \end{tabular}
> 
> The problem with this is that since the all the dollar and caret signs
> are all escaped, the maths will not render.

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?

> 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?

> 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?

Thanks.





^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#71364: Fix Table.el export
  2024-06-07 10:54     ` Eli Zaretskii
@ 2024-06-08  2:10       ` Pranshu
  2024-06-08  6:38         ` Eli Zaretskii
  0 siblings, 1 reply; 17+ messages in thread
From: Pranshu @ 2024-06-08  2:10 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 71364




> 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.

>> 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.

And since the variable is a regexp, it can possibly escape macros, such
as 'LaTeX' -> '\LaTeX'. 

>> 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.

>
> Thanks.





^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#71364: Fix Table.el export
  2024-06-08  2:10       ` Pranshu
@ 2024-06-08  6:38         ` Eli Zaretskii
  2024-06-08  8:15           ` Pranshu
  2024-06-08 10:05           ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 2 replies; 17+ messages in thread
From: Eli Zaretskii @ 2024-06-08  6:38 UTC (permalink / raw)
  To: Pranshu, Reuben Thomas, Vladimir Nikishkin; +Cc: 71364

> From: Pranshu <pranshusharma366@gmail.com>
> 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.





^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#71364: Fix Table.el export
  2024-06-08  6:38         ` Eli Zaretskii
@ 2024-06-08  8:15           ` Pranshu
  2024-06-08 10:05           ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 0 replies; 17+ messages in thread
From: Pranshu @ 2024-06-08  8:15 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Vladimir Nikishkin, 71364, Reuben Thomas

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Pranshu <pranshusharma366@gmail.com>
>> 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.

Yes, initially I was surprised as well.  Initially I was surprised as
well.  I found 2 questions on stack overflow in which they also came to
the same dead end, of not being able to put equations in table(.el)s.

>> >> 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?
>

These characters: "#$~_^%{}&", will all mess something up to different
extents.  For some it's mostly harmless as with the '~', but characters
like '&' will fully mess up the table, as it is used to separate the
columns.

>> 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)?

Yes, it is a good thing.  "Escaping macros" was bad wording, I meant
turning words into macros.  Normally it will not do that, but it can be
customised to do that.

> 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.
>
>> >
>> > 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.
>

Yeah, you probably know better about that then I do.  I will just say
that variables about table.el are extremely hard to find, since of you
"C-h v table ?", you will see 100s of variables thanks to org-mode
tables.  Personally I would avoid creating more variables with 'table' in
their name, but as I said you know a lot more about emacs than I do.

> 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.
>

all good, more perspectives could help.





^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#71364: Fix Table.el export
  2024-06-08  6:38         ` Eli Zaretskii
  2024-06-08  8:15           ` Pranshu
@ 2024-06-08 10:05           ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-06-08 10:51             ` Eli Zaretskii
  1 sibling, 1 reply; 17+ messages in thread
From: Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-06-08 10:05 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Pranshu, Vladimir Nikishkin, 71364

[-- Attachment #1: Type: text/plain, Size: 2726 bytes --]

On Sat, 8 Jun 2024 at 07:38, Eli Zaretskii <eliz@gnu.org> wrote:

>
> 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.
>

I think the explanation is that it is somewhat useful and working, and also
basically broken.

Specifically, it works fine if, like me, you do not want to put LaTeX
markup in tables. This was certainly my case, as I was using it with
org-mode. In this case, any character that is active in LaTeX can and
should simply be escaped on output.

What is basically broken is the ability to export to LaTeX when the table
contains LaTeX markup.


> Reuben and Vladimir, would you please comment on the usability of
> exporting to LaTeX in table.el, and on the proposed improvements?
>

Personally, I think trying to make this work is a mug's game, and having
wrestled as a maintainer with other Emacs code that is over-complicated
because it tries to understand the syntax of e.g. LaTeX or mail buffers
(for example, ispell.el), I would resist adding further support for
specific syntaxes to code that is not part of an editing package for that
syntax.

Again, taking ispell.el, with which I am much more familiar, what I would
like to do there is to strip out all the support for LaTeX and mail
buffers, and instead require LaTeX- or mail-editing modes to call the
spell-checking routines. That would require a different approach globally:
some of the existing ispell commands work on a whole buffer, so they cannot
interact with language-specific code. I guess the code was originally
written like this because it could be created from scratch without changing
anything about other modes.

I think this example of ispell.el is relevant to table.el because much the
same considerations apply: table.el was originally written independent of
other code, but that's not a good design for interacting with other
syntaxes, as you end up implementing half-baked support for them, rather
than allowing an editing mode that already understands the syntax to
interact with the table routines.

Therefore, I recommend not attempting to improve table.el's LaTeX support,
documenting clearly that it doesn't support embedded LaTeX, and designing
functions that allow table.el to cooperate with other packages to export
different embedded syntaxes. Otherwise, we will frustrate users (who will
find the code broken and, if they try to understand it, baffling) and
maintainers (who will spend effort for many years maintaining code that is
half-baked, complicates the modules it lives in, but has to be maintained).

-- 
https://rrt.sc3d.org

[-- Attachment #2: Type: text/html, Size: 4679 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#71364: Fix Table.el export
  2024-06-08 10:05           ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-06-08 10:51             ` Eli Zaretskii
  2024-06-08 10:59               ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 17+ messages in thread
From: Eli Zaretskii @ 2024-06-08 10:51 UTC (permalink / raw)
  To: Reuben Thomas; +Cc: pranshusharma366, lockywolf, 71364

> From: Reuben Thomas <rrt@sc3d.org>
> Date: Sat, 8 Jun 2024 11:05:25 +0100
> Cc: Pranshu <pranshusharma366@gmail.com>, Vladimir Nikishkin <lockywolf@gmail.com>, 
> 	71364@debbugs.gnu.org
> 
> Specifically, it works fine if, like me, you do not want to put LaTeX markup in tables. This was certainly my
> case, as I was using it with org-mode. In this case, any character that is active in LaTeX can and should simply
> be escaped on output.
> 
> What is basically broken is the ability to export to LaTeX when the table contains LaTeX markup.

But the function being discussed is said to be specific to export to
LaTeX, so it should expect LaTeX markup in the cells, no?

> Again, taking ispell.el, with which I am much more familiar, what I would like to do there is to strip out all the
> support for LaTeX and mail buffers, and instead require LaTeX- or mail-editing modes to call the
> spell-checking routines. That would require a different approach globally: some of the existing ispell
> commands work on a whole buffer, so they cannot interact with language-specific code. I guess the code was
> originally written like this because it could be created from scratch without changing anything about other
> modes.
> 
> I think this example of ispell.el is relevant to table.el because much the same considerations apply: table.el
> was originally written independent of other code, but that's not a good design for interacting with other
> syntaxes, as you end up implementing half-baked support for them, rather than allowing an editing mode that
> already understands the syntax to interact with the table routines.
> 
> Therefore, I recommend not attempting to improve table.el's LaTeX support, documenting clearly that it
> doesn't support embedded LaTeX, and designing functions that allow table.el to cooperate with other
> packages to export different embedded syntaxes. Otherwise, we will frustrate users (who will find the code
> broken and, if they try to understand it, baffling) and maintainers (who will spend effort for many years
> maintaining code that is half-baked, complicates the modules it lives in, but has to be maintained).

Again, the function being discussed is specific to LaTeX, AFAIU, so
this is unlike the more-general issue of spell-checking an arbitrary
buffer.  It is more like a hypothetical command ispell-latex-buffer
(if it were to exist).  Don't you agree?





^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#71364: Fix Table.el export
  2024-06-08 10:51             ` Eli Zaretskii
@ 2024-06-08 10:59               ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-06-08 11:18                 ` Eli Zaretskii
  0 siblings, 1 reply; 17+ messages in thread
From: Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-06-08 10:59 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: pranshusharma366, lockywolf, 71364

[-- Attachment #1: Type: text/plain, Size: 1289 bytes --]

On Sat, 8 Jun 2024 at 11:51, Eli Zaretskii <eliz@gnu.org> wrote:

> > From: Reuben Thomas <rrt@sc3d.org>
> > Date: Sat, 8 Jun 2024 11:05:25 +0100
> > Cc: Pranshu <pranshusharma366@gmail.com>, Vladimir Nikishkin <
> lockywolf@gmail.com>,
> >       71364@debbugs.gnu.org
> >
> > Specifically, it works fine if, like me, you do not want to put LaTeX
> markup in tables. This was certainly my
> > case, as I was using it with org-mode. In this case, any character that
> is active in LaTeX can and should simply
> > be escaped on output.
> >
> > What is basically broken is the ability to export to LaTeX when the
> table contains LaTeX markup.
>
> But the function being discussed is said to be specific to export to
> LaTeX, so it should expect LaTeX markup in the cells, no?
>

No, it is supposed to export arbitrary text as valid LaTeX. At least, that
is my understanding.

Again, the function being discussed is specific to LaTeX, AFAIU, so
> this is unlike the more-general issue of spell-checking an arbitrary
> buffer.  It is more like a hypothetical command ispell-latex-buffer
> (if it were to exist).  Don't you agree?
>

The point I was trying to make is that LaTeX-specific code belongs in
LaTeX-specific modes and modules, not in ispell.el or table.el.

-- 
https://rrt.sc3d.org

[-- Attachment #2: Type: text/html, Size: 2488 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#71364: Fix Table.el export
  2024-06-08 10:59               ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-06-08 11:18                 ` Eli Zaretskii
  2024-06-08 11:27                   ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-06-09  4:33                   ` Pranshu
  0 siblings, 2 replies; 17+ messages in thread
From: Eli Zaretskii @ 2024-06-08 11:18 UTC (permalink / raw)
  To: Reuben Thomas; +Cc: pranshusharma366, lockywolf, 71364

> From: Reuben Thomas <rrt@sc3d.org>
> Date: Sat, 8 Jun 2024 11:59:52 +0100
> Cc: pranshusharma366@gmail.com, lockywolf@gmail.com, 71364@debbugs.gnu.org
> 
> On Sat, 8 Jun 2024 at 11:51, Eli Zaretskii <eliz@gnu.org> wrote:
> 
>  > From: Reuben Thomas <rrt@sc3d.org>
>  > Date: Sat, 8 Jun 2024 11:05:25 +0100
>  > Cc: Pranshu <pranshusharma366@gmail.com>, Vladimir Nikishkin <lockywolf@gmail.com>, 
>  >       71364@debbugs.gnu.org
>  > 
>  > Specifically, it works fine if, like me, you do not want to put LaTeX markup in tables. This was certainly
>  my
>  > case, as I was using it with org-mode. In this case, any character that is active in LaTeX can and
>  should simply
>  > be escaped on output.
>  > 
>  > What is basically broken is the ability to export to LaTeX when the table contains LaTeX markup.
> 
>  But the function being discussed is said to be specific to export to
>  LaTeX, so it should expect LaTeX markup in the cells, no?
> 
> No, it is supposed to export arbitrary text as valid LaTeX. At least, that is my understanding.

So it's a YES, because I was saying the same thing.  Or maybe we
disagree about whether a function written for exporting to LaTeX
should or should not expect LaTeX markup.

>  Again, the function being discussed is specific to LaTeX, AFAIU, so
>  this is unlike the more-general issue of spell-checking an arbitrary
>  buffer.  It is more like a hypothetical command ispell-latex-buffer
>  (if it were to exist).  Don't you agree?
> 
> The point I was trying to make is that LaTeX-specific code belongs in LaTeX-specific modes and modules, not
> in ispell.el or table.el.

I don't think I agree with such a radical approach.  From where I
stand, there's nothing wrong with having LaTeX-specific features in
modes that are more general.

In any case, this is beyond the immediate issues discussed in this bug
report, I think.  Broken code must be fixed.





^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#71364: Fix Table.el export
  2024-06-08 11:18                 ` Eli Zaretskii
@ 2024-06-08 11:27                   ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-06-09  4:33                   ` Pranshu
  1 sibling, 0 replies; 17+ messages in thread
From: Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-06-08 11:27 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: pranshusharma366, lockywolf, 71364

[-- Attachment #1: Type: text/plain, Size: 1486 bytes --]

On Sat, 8 Jun 2024 at 12:19, Eli Zaretskii <eliz@gnu.org> wrote:

> > From: Reuben Thomas <rrt@sc3d.org>
> > Date: Sat, 8 Jun 2024 11:59:52 +0100
> > Cc: pranshusharma366@gmail.com, lockywolf@gmail.com,
> 71364@debbugs.gnu.org
> >
> > On Sat, 8 Jun 2024 at 11:51, Eli Zaretskii <eliz@gnu.org> wrote:
> >
> >  > From: Reuben Thomas <rrt@sc3d.org>
> >  > Date: Sat, 8 Jun 2024 11:05:25 +0100
> >  > Cc: Pranshu <pranshusharma366@gmail.com>, Vladimir Nikishkin <
> lockywolf@gmail.com>,
> >  >       71364@debbugs.gnu.org
> >  >
> >  > Specifically, it works fine if, like me, you do not want to put LaTeX
> markup in tables. This was certainly
> >  my
> >  > case, as I was using it with org-mode. In this case, any character
> that is active in LaTeX can and
> >  should simply
> >  > be escaped on output.
> >  >
> >  > What is basically broken is the ability to export to LaTeX when the
> table contains LaTeX markup.
> >
> >  But the function being discussed is said to be specific to export to
> >  LaTeX, so it should expect LaTeX markup in the cells, no?
> >
> > No, it is supposed to export arbitrary text as valid LaTeX. At least,
> that is my understanding.
>
> So it's a YES, because I was saying the same thing.  Or maybe we
> disagree about whether a function written for exporting to LaTeX
> should or should not expect LaTeX markup.
>

It looks like I was wrong: `table--generate-source-scan-lines` is expecting
LaTeX input.

Good luck with that!

-- 
https://rrt.sc3d.org

[-- Attachment #2: Type: text/html, Size: 3117 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#71364: Fix Table.el export
  2024-06-08 11:18                 ` Eli Zaretskii
  2024-06-08 11:27                   ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-06-09  4:33                   ` Pranshu
  2024-06-09  8:15                     ` Eli Zaretskii
  1 sibling, 1 reply; 17+ messages in thread
From: Pranshu @ 2024-06-09  4:33 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: lockywolf, 71364, Reuben Thomas


Now that this is sorted, do you want me to send an updated diff with a
seperate variable for backslash?





^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#71364: Fix Table.el export
  2024-06-09  4:33                   ` Pranshu
@ 2024-06-09  8:15                     ` Eli Zaretskii
  2024-06-09  8:33                       ` Pranshu
  2024-06-21  8:25                       ` Pranshu
  0 siblings, 2 replies; 17+ messages in thread
From: Eli Zaretskii @ 2024-06-09  8:15 UTC (permalink / raw)
  To: Pranshu; +Cc: lockywolf, 71364, rrt

> From: Pranshu <pranshusharma366@gmail.com>
> Cc: Reuben Thomas <rrt@sc3d.org>,  lockywolf@gmail.com,  71364@debbugs.gnu.org
> Date: Sun, 09 Jun 2024 14:33:28 +1000
> 
> 
> Now that this is sorted, do you want me to send an updated diff with a
> seperate variable for backslash?

It isn't sorted yet, so please wait.





^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#71364: Fix Table.el export
  2024-06-09  8:15                     ` Eli Zaretskii
@ 2024-06-09  8:33                       ` Pranshu
  2024-06-21  8:25                       ` Pranshu
  1 sibling, 0 replies; 17+ messages in thread
From: Pranshu @ 2024-06-09  8:33 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: lockywolf, 71364, rrt

[-- Attachment #1: Type: text/plain, Size: 414 bytes --]

no problem

On Sun, 9 Jun 2024 at 18:16, Eli Zaretskii <eliz@gnu.org> wrote:

> > From: Pranshu <pranshusharma366@gmail.com>
> > Cc: Reuben Thomas <rrt@sc3d.org>,  lockywolf@gmail.com,
> 71364@debbugs.gnu.org
> > Date: Sun, 09 Jun 2024 14:33:28 +1000
> >
> >
> > Now that this is sorted, do you want me to send an updated diff with a
> > seperate variable for backslash?
>
> It isn't sorted yet, so please wait.
>

[-- Attachment #2: Type: text/html, Size: 982 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#71364: Fix Table.el export
  2024-06-09  8:15                     ` Eli Zaretskii
  2024-06-09  8:33                       ` Pranshu
@ 2024-06-21  8:25                       ` Pranshu
  2024-06-22  9:39                         ` Eli Zaretskii
  1 sibling, 1 reply; 17+ messages in thread
From: Pranshu @ 2024-06-21  8:25 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: lockywolf, 71364, rrt

[-- Attachment #1: Type: text/plain, Size: 444 bytes --]

How about now, it has been about 2 weeks

On Sun, 9 Jun 2024 at 18:16, Eli Zaretskii <eliz@gnu.org> wrote:

> > From: Pranshu <pranshusharma366@gmail.com>
> > Cc: Reuben Thomas <rrt@sc3d.org>,  lockywolf@gmail.com,
> 71364@debbugs.gnu.org
> > Date: Sun, 09 Jun 2024 14:33:28 +1000
> >
> >
> > Now that this is sorted, do you want me to send an updated diff with a
> > seperate variable for backslash?
>
> It isn't sorted yet, so please wait.
>

[-- Attachment #2: Type: text/html, Size: 1012 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#71364: Fix Table.el export
  2024-06-21  8:25                       ` Pranshu
@ 2024-06-22  9:39                         ` Eli Zaretskii
  0 siblings, 0 replies; 17+ messages in thread
From: Eli Zaretskii @ 2024-06-22  9:39 UTC (permalink / raw)
  To: Pranshu, lockywolf; +Cc: 71364, rrt

> From: Pranshu <pranshusharma366@gmail.com>
> Date: Fri, 21 Jun 2024 18:25:46 +1000
> Cc: rrt@sc3d.org, lockywolf@gmail.com, 71364@debbugs.gnu.org
> 
> How about now, it has been about 2 weeks

I'd like to hear from Vladimir as well.

Vladimir, would you please chime in and comment on this proposal?





^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2024-06-22  9:39 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-04 11:22 bug#71364: Fix Table.el export Pranshu
2024-06-06 11:35 ` Eli Zaretskii
2024-06-07  7:00   ` Pranshu
2024-06-07 10:54     ` Eli Zaretskii
2024-06-08  2:10       ` Pranshu
2024-06-08  6:38         ` Eli Zaretskii
2024-06-08  8:15           ` Pranshu
2024-06-08 10:05           ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-08 10:51             ` Eli Zaretskii
2024-06-08 10:59               ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-08 11:18                 ` Eli Zaretskii
2024-06-08 11:27                   ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-09  4:33                   ` Pranshu
2024-06-09  8:15                     ` Eli Zaretskii
2024-06-09  8:33                       ` Pranshu
2024-06-21  8:25                       ` Pranshu
2024-06-22  9:39                         ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).