GNU bug report logs - #28405
Inhibit auto-fill & LaTeX-indent-environment-list

Previous Next

Package: auctex;

Reported by: gojjoe <at> gmail.com

Date: Sun, 10 Sep 2017 11:11:02 UTC

Severity: normal

Done: Ikumi Keita <ikumi <at> ikumi.que.jp>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 28405 in the body.
You can then email your comments to 28405 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-auctex <at> gnu.org:
bug#28405; Package auctex. (Sun, 10 Sep 2017 11:11:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to gojjoe <at> gmail.com:
New bug report received and forwarded. Copy sent to bug-auctex <at> gnu.org. (Sun, 10 Sep 2017 11:11:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: gojjoe <at> gmail.com
To: bug-auctex <at> gnu.org
Subject: Inhibit auto-fill & LaTeX-indent-environment-list
Date: Sun, 10 Sep 2017 13:10:30 +0200
Dear All,

– Not really a bug:

I have auto-fill mode on when editing tex files in LaTeX mode. I'd like to inhibit the fill functions within math environments like "equation", "gather", "align", though.

One way to achieve this is given by Thomas here:

https://tex.stackexchange.com/questions/69555/i-want-to-disable-auto-fill-mode-when-editing-equations#11480465

This solution works with "equation" and "align", but strangely not with "gather" and "multline". The reason, I think, is that the latter are not included in LaTeX-indent-environment-list in its standard/global value, while "align" and "equation" are. I can customize and include them manually, but is there a reason why gather and multline aren't included?

Cheers,
J




Information forwarded to bug-auctex <at> gnu.org:
bug#28405; Package auctex. (Sun, 10 Sep 2017 11:20:01 GMT) Full text and rfc822 format available.

Message #8 received at 28405 <at> debbugs.gnu.org (full text, mbox):

From: David Kastrup <dak <at> gnu.org>
To: gojjoe <at> gmail.com
Cc: 28405 <at> debbugs.gnu.org
Subject: Re: bug#28405: Inhibit auto-fill & LaTeX-indent-environment-list
Date: Sun, 10 Sep 2017 13:18:54 +0200
gojjoe <at> gmail.com writes:

> Dear All,
>
> – Not really a bug:
>
> I have auto-fill mode on when editing tex files in LaTeX mode. I'd
> like to inhibit the fill functions within math environments like
> "equation", "gather", "align", though.
>
> One way to achieve this is given by Thomas here:
>
> https://tex.stackexchange.com/questions/69555/i-want-to-disable-auto-fill-mode-when-editing-equations#11480465
>
> This solution works with "equation" and "align", but strangely not
> with "gather" and "multline". The reason, I think, is that the latter
> are not included in LaTeX-indent-environment-list in its
> standard/global value, while "align" and "equation" are. I can
> customize and include them manually, but is there a reason why gather
> and multline aren't included?

In my default setting, align is _not_ included; you likely added it
yourself.

It is the job of amsmath.el to include most of those settings, so it's
likely that you haven't document parsing enabled and/or working.

See the first page of AUCTeX's documentation for more info.

-- 
David Kastrup




Information forwarded to bug-auctex <at> gnu.org:
bug#28405; Package auctex. (Sun, 10 Sep 2017 11:23:02 GMT) Full text and rfc822 format available.

Message #11 received at 28405 <at> debbugs.gnu.org (full text, mbox):

From: David Kastrup <dak <at> gnu.org>
To: gojjoe <at> gmail.com
Cc: 28405 <at> debbugs.gnu.org
Subject: Re: bug#28405: Inhibit auto-fill & LaTeX-indent-environment-list
Date: Sun, 10 Sep 2017 13:22:42 +0200
David Kastrup <dak <at> gnu.org> writes:

> gojjoe <at> gmail.com writes:
>
>> Dear All,
>>
>> – Not really a bug:
>>
>> I have auto-fill mode on when editing tex files in LaTeX mode. I'd
>> like to inhibit the fill functions within math environments like
>> "equation", "gather", "align", though.
>>
>> One way to achieve this is given by Thomas here:
>>
>> https://tex.stackexchange.com/questions/69555/i-want-to-disable-auto-fill-mode-when-editing-equations#11480465
>>
>> This solution works with "equation" and "align", but strangely not
>> with "gather" and "multline". The reason, I think, is that the latter
>> are not included in LaTeX-indent-environment-list in its
>> standard/global value, while "align" and "equation" are. I can
>> customize and include them manually, but is there a reason why gather
>> and multline aren't included?
>
> In my default setting, align is _not_ included; you likely added it
> yourself.

I have to take that back after updating the AUCTeX repository.  There is

1100cd8c1 (Tassilo Horn                   2013-10-14 11:42:31 +0200 3130)     ("align" LaTeX-indent-tabular)
1100cd8c1 (Tassilo Horn                   2013-10-14 11:42:31 +0200 3131)     ("align*" LaTeX-indent-tabular)

in latex.el.  The rest, however, holds:

> It is the job of amsmath.el to include most of those settings, so it's
> likely that you haven't document parsing enabled and/or working.
>
> See the first page of AUCTeX's documentation for more info.

-- 
David Kastrup




Information forwarded to bug-auctex <at> gnu.org:
bug#28405; Package auctex. (Sun, 10 Sep 2017 11:40:02 GMT) Full text and rfc822 format available.

Message #14 received at 28405 <at> debbugs.gnu.org (full text, mbox):

From: gojjoe <at> gmail.com
To: 28405 <at> debbugs.gnu.org
Cc: David Kastrup <dak <at> gnu.org>
Subject: Re: bug#28405: Inhibit auto-fill & LaTeX-indent-environment-list
Date: Sun, 10 Sep 2017 13:39:02 +0200
Hi David,

>> It is the job of amsmath.el to include most of those settings, so it's
>> likely that you haven't document parsing enabled and/or working.
>>
>> See the first page of AUCTeX's documentation for more info.


Indeed. What's strange is that I:

1. delete the auto-generated el style file for this particular buffer
2. reset AUCTex with C-u C-c C-n 
3. check the message logs and I see it's loading amsmath.elc:

Loading c:/[...]/.emacs.d/elpa/auctex-11.91.0/style/amsmath.elc...done

4. inquiry about the value of LaTeX-indent-environment-list in that buffer, but "gather" and "multline" and several amsmath others do *not* appear there.

I'm now checking the other style files loaded by auctex-reset to see whether any of them is causing this problem. I'm not loading any custom-made style files, though.

Cheers,
J




Information forwarded to bug-auctex <at> gnu.org:
bug#28405; Package auctex. (Sun, 10 Sep 2017 12:23:01 GMT) Full text and rfc822 format available.

Message #17 received at 28405 <at> debbugs.gnu.org (full text, mbox):

From: gojjoe <at> gmail.com
To: 28405 <at> debbugs.gnu.org
Cc: David Kastrup <dak <at> gnu.org>
Subject: Re: bug#28405: Inhibit auto-fill & LaTeX-indent-environment-list
Date: Sun, 10 Sep 2017 14:22:03 +0200

On 2017-09-10 13:39, gojjoe <at> gmail.com wrote:
> I'm now checking the other style files loaded by auctex-reset to see whether any of them is causing this problem. I'm not loading any custom-made style files, though.

Could the culprit be amsmath.el itself? I've manually added to it

(add-to-list 'LaTeX-indent-environment-list '("gather" LaTeX-indent-tabular) t)
 
and now "gather" appears in LaTeX-indent-environment-list.

I see that amsmath.el does issue a "LaTeX-add-environments", but no "(add-to-list 'LaTeX-indent-environment-list..."

Cheers,
J




Information forwarded to bug-auctex <at> gnu.org:
bug#28405; Package auctex. (Tue, 01 Feb 2022 09:38:01 GMT) Full text and rfc822 format available.

Message #20 received at 28405 <at> debbugs.gnu.org (full text, mbox):

From: Ikumi Keita <ikumi <at> ikumi.que.jp>
To: Uwe Brauer <oub <at> mat.ucm.es>
Cc: auctex-devel <auctex-devel <at> gnu.org>, 28405 <at> debbugs.gnu.org
Subject: Re: Adding entries to LaTeX-indent-environment-list
Date: Tue, 01 Feb 2022 18:37:31 +0900
[ Added 28405 <at> debbugs.gnu.org to Cc: ]

>>>>> Uwe Brauer <oub <at> mat.ucm.es> writes:
>>>> "IK" == Ikumi Keita <ikumi <at> ikumi.que.jp> writes:
>> Hi all,
>>>>>>> Ikumi Keita <ikumi <at> ikumi.que.jp> writes:
>>> Thanks for the check. I installed the enhanced fix into the git
>>> repository.

>> I have tweaked LaTeX-indent-environment-list and I noticed bug#28405 [1].
>> Should we add gather and multline environments as well to
>> LaTeX-indent-environment-list like this?

>> diff --git a/style/amsmath.el b/style/amsmath.el
>> index e3cce752..d5fb1da6 100644
>> --- a/style/amsmath.el
>> +++ b/style/amsmath.el
>> @@ -154,7 +154,8 @@
 
>> (setq-local LaTeX-indent-environment-list
>> (append LaTeX-indent-environment-list
>> -                       '(("equation*")
>> +                       '(("equation*") ("gather") ("gather*")
>> +                         ("gathered") ("multline") ("multline*")
>> ("align"       LaTeX-indent-tabular)
>> ("align*"      LaTeX-indent-tabular)
>> ("aligned"     LaTeX-indent-tabular)

>> Note that this fixes bug#28405 whereas it disables filling inside gather
>> and multline environments, which might confuse some users.

> I am confused that patches of your disable the filling inside gather and
> multiline environments? That is to say very long lines are not filled
> anymore?

Yes. More precisely, auto fill still works. However, explicit filling
invoked by M-q, C-c C-q C-e etc. is disabled.

> Hm, I have not tried that out, but my first impression is: I'd
> rather prefer long lines to be broken, (filled) automatically otherwise
> it is confusing.

I have the same idea. It's confusing and inconvenient for users like us.
However,
1. bug#28405 shows that there does exist users who don't think so and
   prefer filling is disabled inside math environmnets.
2. Filling has already been disabled in "equation", "equation*" and
   "displaymath" environments in AUCTeX. In other words, there is
   inconsistency between those envs and "gather", "multline" envs.

Hence I think we should discuss what to do with users of various ideas.

Regards,
Ikumi Keita

>> [1] https://debbugs.gnu.org/cgi/bugreport.cgi?bug=28405




Information forwarded to bug-auctex <at> gnu.org:
bug#28405; Package auctex. (Tue, 01 Feb 2022 11:03:01 GMT) Full text and rfc822 format available.

Message #23 received at 28405 <at> debbugs.gnu.org (full text, mbox):

From: Uwe Brauer <oub <at> mat.ucm.es>
To: Ikumi Keita <ikumi <at> ikumi.que.jp>
Cc: Uwe Brauer <oub <at> mat.ucm.es>, 28405 <at> debbugs.gnu.org,
 auctex-devel <auctex-devel <at> gnu.org>
Subject: Re: Adding entries to LaTeX-indent-environment-list
Date: Tue, 01 Feb 2022 12:02:07 +0100
[Message part 1 (text/plain, inline)]
>>> "IK" == Ikumi Keita <ikumi <at> ikumi.que.jp> writes:

> [ Added 28405 <at> debbugs.gnu.org to Cc: ]
>>>>>> Uwe Brauer <oub <at> mat.ucm.es> writes:
>>>>> "IK" == Ikumi Keita <ikumi <at> ikumi.que.jp> writes:
>>> Hi all,
>>>>>>>> Ikumi Keita <ikumi <at> ikumi.que.jp> writes:
>>> Thanks for the check. I installed the enhanced fix into the git
>>> repository.

>>> I have tweaked LaTeX-indent-environment-list and I noticed bug#28405 [1].
>>> Should we add gather and multline environments as well to
>>> LaTeX-indent-environment-list like this?

>>> diff --git a/style/amsmath.el b/style/amsmath.el
>>> index e3cce752..d5fb1da6 100644
>>> --- a/style/amsmath.el
>>> +++ b/style/amsmath.el
>>> @@ -154,7 +154,8 @@
 
>>> (setq-local LaTeX-indent-environment-list
>>> (append LaTeX-indent-environment-list
>>> -                       '(("equation*")
>>> +                       '(("equation*") ("gather") ("gather*")
>>> +                         ("gathered") ("multline") ("multline*")
>>> ("align"       LaTeX-indent-tabular)
>>> ("align*"      LaTeX-indent-tabular)
>>> ("aligned"     LaTeX-indent-tabular)

>>> Note that this fixes bug#28405 whereas it disables filling inside gather
>>> and multline environments, which might confuse some users.

>> I am confused that patches of your disable the filling inside gather and
>> multiline environments? That is to say very long lines are not filled
>> anymore?

> Yes. More precisely, auto fill still works. However, explicit filling
> invoked by M-q, C-c C-q C-e etc. is disabled.

>> Hm, I have not tried that out, but my first impression is: I'd
>> rather prefer long lines to be broken, (filled) automatically otherwise
>> it is confusing.

> I have the same idea. It's confusing and inconvenient for users like us.
> However,
> 1. bug#28405 shows that there does exist users who don't think so and
>    prefer filling is disabled inside math environmnets.
> 2. Filling has already been disabled in "equation", "equation*" and
>    "displaymath" environments in AUCTeX. In other words, there is
>    inconsistency between those envs and "gather", "multline" envs.

Oh now I understand why I was so confused lately. 

How can I turn filling on for these environments.

Disabling filling makes my life harder 😕
[smime.p7s (application/pkcs7-signature, attachment)]

Information forwarded to bug-auctex <at> gnu.org:
bug#28405; Package auctex. (Tue, 01 Feb 2022 18:53:01 GMT) Full text and rfc822 format available.

Message #26 received at 28405 <at> debbugs.gnu.org (full text, mbox):

From: Arash Esbati <arash <at> gnu.org>
To: Ikumi Keita <ikumi <at> ikumi.que.jp>
Cc: Uwe Brauer <oub <at> mat.ucm.es>, 28405 <at> debbugs.gnu.org,
 auctex-devel <auctex-devel <at> gnu.org>
Subject: Re: bug#28405: Adding entries to LaTeX-indent-environment-list
Date: Tue, 01 Feb 2022 19:51:29 +0100
Hi Keita,

Ikumi Keita <ikumi <at> ikumi.que.jp> writes:

>>> I have tweaked LaTeX-indent-environment-list and I noticed bug#28405 [1].
>>> Should we add gather and multline environments as well to
>>> LaTeX-indent-environment-list like this?
>
>>> diff --git a/style/amsmath.el b/style/amsmath.el
>>> index e3cce752..d5fb1da6 100644
>>> --- a/style/amsmath.el
>>> +++ b/style/amsmath.el
>>> @@ -154,7 +154,8 @@
>  
>>> (setq-local LaTeX-indent-environment-list
>>> (append LaTeX-indent-environment-list
>>> -                       '(("equation*")
>>> +                       '(("equation*") ("gather") ("gather*")
>>> +                         ("gathered") ("multline") ("multline*")
>>> ("align"       LaTeX-indent-tabular)
>>> ("align*"      LaTeX-indent-tabular)
>>> ("aligned"     LaTeX-indent-tabular)
>
>>> Note that this fixes bug#28405 whereas it disables filling inside gather
>>> and multline environments, which might confuse some users.
>
> I have the same idea. It's confusing and inconvenient for users like us.
> However,
> 1. bug#28405 shows that there does exist users who don't think so and
>    prefer filling is disabled inside math environmnets.
> 2. Filling has already been disabled in "equation", "equation*" and
>    "displaymath" environments in AUCTeX. In other words, there is
>    inconsistency between those envs and "gather", "multline" envs.

Thanks for raising this inconsistency.  My vote is to harmonize this and
add all math environments to `LaTeX-indent-environment-list',
i.e. disabling filling.  Then the question is how a user can control the
custom variable when we add entries to it as a style is loaded like in
your patch above?  For example, how can I decide here that "multline"
shouldn't be in that variable?  Or am I missing something?

Best, Arash




Information forwarded to bug-auctex <at> gnu.org:
bug#28405; Package auctex. (Tue, 01 Feb 2022 20:33:01 GMT) Full text and rfc822 format available.

Message #29 received at 28405 <at> debbugs.gnu.org (full text, mbox):

From: Uwe Brauer <oub <at> mat.ucm.es>
To: Arash Esbati <arash <at> gnu.org>
Cc: Ikumi Keita <ikumi <at> ikumi.que.jp>, auctex-devel <auctex-devel <at> gnu.org>,
 28405 <at> debbugs.gnu.org, Uwe Brauer <oub <at> mat.ucm.es>
Subject: Re: bug#28405: Adding entries to LaTeX-indent-environment-list
Date: Tue, 01 Feb 2022 21:32:05 +0100
[Message part 1 (text/plain, inline)]
> Hi Keita,
> Ikumi Keita <ikumi <at> ikumi.que.jp> writes:


> Thanks for raising this inconsistency.  My vote is to harmonize this and
> add all math environments to `LaTeX-indent-environment-list',
> i.e. disabling filling.  Then the question is how a user can control the
> custom variable when we add entries to it as a style is loaded like in
> your patch above?  For example, how can I decide here that "multline"
> shouldn't be in that variable?  Or am I missing something?

I am deeply puzzled now.

    1. I like Keita's patch because it results in filling with a much
       better indenting.

    2. But, are you saying the price for this is that auto-filling is
       disabled and I have to deal with very long equations myself? Why
       is this so? I'd rather would like to have nice indentation and
       auto-filling. Rational: more and more (No emacs) users use editor
       that support virtual filling and that results in long equation.
       It is true that virtual-auto-fill-mode (available in MELPA) is quite
       good, but I still prefer good all breaks at 70 chars, and
       therefore auto-fill-mode

Uwe 
[smime.p7s (application/pkcs7-signature, attachment)]

Information forwarded to bug-auctex <at> gnu.org:
bug#28405; Package auctex. (Tue, 01 Feb 2022 21:24:02 GMT) Full text and rfc822 format available.

Message #32 received at 28405 <at> debbugs.gnu.org (full text, mbox):

From: Arash Esbati <arash <at> gnu.org>
To: Uwe Brauer <oub <at> mat.ucm.es>
Cc: Ikumi Keita <ikumi <at> ikumi.que.jp>, 28405 <at> debbugs.gnu.org,
 auctex-devel <auctex-devel <at> gnu.org>
Subject: Re: bug#28405: Adding entries to LaTeX-indent-environment-list
Date: Tue, 01 Feb 2022 22:23:31 +0100
Uwe Brauer <oub <at> mat.ucm.es> writes:

> I am deeply puzzled now.
>
>     1. I like Keita's patch because it results in filling with a much
>        better indenting.
>
>     2. But, are you saying the price for this is that auto-filling is
>        disabled and I have to deal with very long equations myself? Why
>        is this so? I'd rather would like to have nice indentation and
>        auto-filling. Rational: more and more (No emacs) users use editor
>        that support virtual filling and that results in long equation.
>        It is true that virtual-auto-fill-mode (available in MELPA) is quite
>        good, but I still prefer good all breaks at 70 chars, and
>        therefore auto-fill-mode

I'm not sure if we're talking about the same thing.  Docstring of
`LaTeX-indent-environment-list' says:

,----[ C-h v LaTeX-indent-environment-list RET ]
| LaTeX-indent-environment-list is a variable defined in ‘latex.el’.
| 
| Alist of environments with special indentation.
| The second element in each entry is the function to calculate the
| indentation level in columns.
| 
| Environments present in this list are not filled by filling
| functions, see ‘LaTeX-fill-region-as-paragraph’.
| 
|   You can customize this variable.
| 
| Value:
| (("verbatim" current-indentation)
|  ("verbatim*" current-indentation)
|  ("filecontents" current-indentation)
|  ("filecontents*" current-indentation)
|  ("tabular" LaTeX-indent-tabular)
|  ("tabular*" LaTeX-indent-tabular)
|  ("array" LaTeX-indent-tabular)
|  ("eqnarray" LaTeX-indent-tabular)
|  ("eqnarray*" LaTeX-indent-tabular)
|  ("displaymath")
|  ("equation")
|  ("picture")
|  ("tabbing"))
`----

and the one for `LaTeX-fill-region-as-paragraph' says:

,----[ C-h f LaTeX-fill-region-as-paragraph RET ]
| LaTeX-fill-region-as-paragraph is an interactive native compiled Lisp
| function in ‘latex.el’.
| 
| (LaTeX-fill-region-as-paragraph FROM TO &optional JUSTIFY-FLAG)
| 
| Fill region as one paragraph.
| Break lines to fit ‘fill-column’, but leave all lines ending with
| \\ (plus its optional argument) alone.  Lines with code
| comments and lines ending with ‘\par’ are included in filling but
| act as boundaries.  Prefix arg means justify too.  From program,
| pass args FROM, TO and JUSTIFY-FLAG.
| 
| You can disable filling inside a specific environment by adding
| it to ‘LaTeX-indent-environment-list’, only indentation is
| performed in that case.
| 
`----

Now take this small example:

  \documentclass[a4paper]{article}
  \begin{document}
  \begin{equation}
    a
    a
    a
    a
  \end{equation}
  \end{document}
  %%% Local Variables:
  %%% mode: latex
  %%% TeX-master: t
  %%% End:

Put the point inside the equation environment and hit 'M-q', nothing
happens.  When you type in material, there is a line-wrapping at
`fill-column', but that's all.

So basically this is what happens with Keita's patch: line-wrapping will
happen when you enter math, but hitting 'M-q' later is disabled.
Hitting 'TAB' will adjust the indentation of a line, but there is no
filling.  And there is a comment in `LaTeX-indent-environment-list':

 ;; The following should have their own, smart indentation function.
 ;; Some other day.
 ("displaymath")
 ("equation")
 ("picture")
 ("tabbing"))

Best, Arash




Information forwarded to bug-auctex <at> gnu.org:
bug#28405; Package auctex. (Wed, 02 Feb 2022 08:39:02 GMT) Full text and rfc822 format available.

Message #35 received at 28405 <at> debbugs.gnu.org (full text, mbox):

From: Ikumi Keita <ikumi <at> ikumi.que.jp>
To: Arash Esbati <arash <at> gnu.org>
Cc: Uwe Brauer <oub <at> mat.ucm.es>, 28405 <at> debbugs.gnu.org,
 auctex-devel <auctex-devel <at> gnu.org>
Subject: Re: bug#28405: Adding entries to LaTeX-indent-environment-list
Date: Wed, 02 Feb 2022 17:37:54 +0900
Hi Arash,

>>>>> Arash Esbati <arash <at> gnu.org> writes:
> Thanks for raising this inconsistency.  My vote is to harmonize this and
> add all math environments to `LaTeX-indent-environment-list',
> i.e. disabling filling.  Then the question is how a user can control the
> custom variable when we add entries to it as a style is loaded like in
> your patch above?  For example, how can I decide here that "multline"
> shouldn't be in that variable?  Or am I missing something?

Thank you for pointing this out. I realized that my recent commits
aren't compatible with user's customization on
`LaTeX-indent-environment-list'. I have to reconsider implementation.

After some thoughts, my basic plan is to revert addition to
`LaTeX-indent-environment-list' in amsmath.el and mathtools.el and
include them in default value of `LaTeX-indent-environment-list' in
latex.el. In this way, math envs with alignment would be handled
properly.

With respect to math envs without alignment, e.g. "equation",
"displaymath" and "gather", I think there are two approaches:
1. Remove them from default value of `LaTeX-indent-environment-list'.
   Users who want to disable filling in such envs customize the option
   to add entries such as ("equation"), ("displaymath") and so on.
2. Include them in default value of `LaTeX-indent-environment-list'.
   Users who want filling in such envs customize the option to remove
   those entries.

What do you think about the above ideas?

Regards,
Ikumi Keita




Information forwarded to bug-auctex <at> gnu.org:
bug#28405; Package auctex. (Wed, 02 Feb 2022 10:02:01 GMT) Full text and rfc822 format available.

Message #38 received at 28405 <at> debbugs.gnu.org (full text, mbox):

From: Arash Esbati <arash <at> gnu.org>
To: Ikumi Keita <ikumi <at> ikumi.que.jp>
Cc: Uwe Brauer <oub <at> mat.ucm.es>, 28405 <at> debbugs.gnu.org,
 auctex-devel <auctex-devel <at> gnu.org>
Subject: Re: bug#28405: Adding entries to LaTeX-indent-environment-list
Date: Wed, 02 Feb 2022 10:58:08 +0100
Hi Keita,

Ikumi Keita <ikumi <at> ikumi.que.jp> writes:

> With respect to math envs without alignment, e.g. "equation",
> "displaymath" and "gather", I think there are two approaches:
> 1. Remove them from default value of `LaTeX-indent-environment-list'.
>    Users who want to disable filling in such envs customize the option
>    to add entries such as ("equation"), ("displaymath") and so on.
> 2. Include them in default value of `LaTeX-indent-environment-list'.
>    Users who want filling in such envs customize the option to remove
>    those entries.
>
> What do you think about the above ideas?

I'm not sure about 1.  I haven't checked but this behavior was there
probably forever and we don't have a smart filling for equations w/o
alignment.  Do we want to pass this to Emacs standard filling rules?

About 2., we're talking about these environments, right:

  ("equation*") ("gather") ("gather*")
  ("gathered") ("multline") ("multline*")

The reason I'm asking is I was also thinking about a third solution
which can be in the styles.  There, we can check if user has removed the
LaTeX standard environments from `LaTeX-indent-environment-list' and
then make a decision.  Essentially in amsmath.el:

  (when (or (assoc "equation" LaTeX-indent-environment-list)
            (assoc "displaymath" LaTeX-indent-environment-list))
   <add other environments to `LaTeX-indent-environment-list'>)

What do you think, does this make sense?

Best, Arash




Information forwarded to bug-auctex <at> gnu.org:
bug#28405; Package auctex. (Wed, 02 Feb 2022 10:49:01 GMT) Full text and rfc822 format available.

Message #41 received at 28405 <at> debbugs.gnu.org (full text, mbox):

From: Uwe Brauer <oub <at> mat.ucm.es>
To: Arash Esbati <arash <at> gnu.org>
Cc: Uwe Brauer <oub <at> mat.ucm.es>, auctex-devel <auctex-devel <at> gnu.org>,
 28405 <at> debbugs.gnu.org, Ikumi Keita <ikumi <at> ikumi.que.jp>
Subject: Re: bug#28405: Adding entries to LaTeX-indent-environment-list
Date: Wed, 02 Feb 2022 11:48:41 +0100
[Message part 1 (text/plain, inline)]
>>> "AE" == Arash Esbati <arash <at> gnu.org> writes:
Hi Arash
> Uwe Brauer <oub <at> mat.ucm.es> writes:
>> I am deeply puzzled now.
>> 
>> 1. I like Keita's patch because it results in filling with a much
>> better indenting.
>> 
>> 2. But, are you saying the price for this is that auto-filling is
>> disabled and I have to deal with very long equations myself? Why
>> is this so? I'd rather would like to have nice indentation and
>> auto-filling. Rational: more and more (No emacs) users use editor
>> that support virtual filling and that results in long equation.
>> It is true that virtual-auto-fill-mode (available in MELPA) is quite
>> good, but I still prefer good all breaks at 70 chars, and
>> therefore auto-fill-mode

> I'm not sure if we're talking about the same thing.  Docstring of
> `LaTeX-indent-environment-list' says:

> ,----[ C-h v LaTeX-indent-environment-list RET ]
> | LaTeX-indent-environment-list is a variable defined in ‘latex.el’.
> | 
> | Alist of environments with special indentation.
> | The second element in each entry is the function to calculate the
> | indentation level in columns.
> | 
> | Environments present in this list are not filled by filling
> | functions, see ‘LaTeX-fill-region-as-paragraph’.
> | 
> |   You can customize this variable.
> | 
> | Value:
> | (("verbatim" current-indentation)
> |  ("verbatim*" current-indentation)
> |  ("filecontents" current-indentation)
> |  ("filecontents*" current-indentation)
> |  ("tabular" LaTeX-indent-tabular)
> |  ("tabular*" LaTeX-indent-tabular)
> |  ("array" LaTeX-indent-tabular)
> |  ("eqnarray" LaTeX-indent-tabular)
> |  ("eqnarray*" LaTeX-indent-tabular)
> |  ("displaymath")
> |  ("equation")
> |  ("picture")
> |  ("tabbing"))
> `----

> and the one for `LaTeX-fill-region-as-paragraph' says:

> ,----[ C-h f LaTeX-fill-region-as-paragraph RET ]
> | LaTeX-fill-region-as-paragraph is an interactive native compiled Lisp
> | function in ‘latex.el’.
> | 
> | (LaTeX-fill-region-as-paragraph FROM TO &optional JUSTIFY-FLAG)
> | 
> | Fill region as one paragraph.
> | Break lines to fit ‘fill-column’, but leave all lines ending with
> | \\ (plus its optional argument) alone.  Lines with code
> | comments and lines ending with ‘\par’ are included in filling but
> | act as boundaries.  Prefix arg means justify too.  From program,
> | pass args FROM, TO and JUSTIFY-FLAG.
> | 
> | You can disable filling inside a specific environment by adding
> | it to ‘LaTeX-indent-environment-list’, only indentation is
> | performed in that case.
> | 
> `----

> Now take this small example:

>   \documentclass[a4paper]{article}
>   \begin{document}
>   \begin{equation}
>     a
>     a
>     a
>     a
>   \end{equation}
>   \end{document}
>   %%% Local Variables:
>   %%% mode: latex
>   %%% TeX-master: t
>   %%% End:

> Put the point inside the equation environment and hit 'M-q', nothing
> happens.  When you type in material, there is a line-wrapping at
> `fill-column', but that's all.

> So basically this is what happens with Keita's patch: line-wrapping will
> happen when you enter math, but hitting 'M-q' later is disabled.
> Hitting 'TAB' will adjust the indentation of a line, but there is no
> filling.  And there is a comment in `LaTeX-indent-environment-list':


Hm, here is a situation that you did not cover. I am not talking about
editing an equation, I am taking about filling a badly formatted equation

Suppose you have (or have a received) a file of that form

\documentclass[a4paper]{article}
\begin{document}
\begin{equation}
a = \left.\int very very long expression in one line\begin{array}
  a
  a
  a
\end{equation}
\end{document}


So the equation is badly indented and consist of very long lines.

So I basically want  LaTeX-fill-environment to indent the environment
correctly, and that thanks to the patch is no better, but I also want
long lines to be broken/wrapped

So far I have seen that I have to jump the end of long lines, press
space and the line is broken/wrapped, but this extra typing is not very
comfortable.

Did I explain this now better?

Regards

Uwe 
[smime.p7s (application/pkcs7-signature, attachment)]

Information forwarded to bug-auctex <at> gnu.org:
bug#28405; Package auctex. (Wed, 02 Feb 2022 11:46:01 GMT) Full text and rfc822 format available.

Message #44 received at 28405 <at> debbugs.gnu.org (full text, mbox):

From: Arash Esbati <arash <at> gnu.org>
To: Uwe Brauer <oub <at> mat.ucm.es>
Cc: Ikumi Keita <ikumi <at> ikumi.que.jp>, 28405 <at> debbugs.gnu.org,
 auctex-devel <auctex-devel <at> gnu.org>
Subject: Re: bug#28405: Adding entries to LaTeX-indent-environment-list
Date: Wed, 02 Feb 2022 12:45:04 +0100
Uwe Brauer <oub <at> mat.ucm.es> writes:

> Suppose you have (or have a received) a file of that form
>
> \documentclass[a4paper]{article}
> \begin{document}
> \begin{equation}
> a = \left.\int very very long expression in one line\begin{array}
>   a
>   a
>   a
> \end{equation}
> \end{document}
>
> So the equation is badly indented and consist of very long lines.

I'd go back to the sender telling him his code is utterly broken and I
will not fix it 😉

> So I basically want  LaTeX-fill-environment to indent the environment
> correctly, and that thanks to the patch is no better, but I also want
> long lines to be broken/wrapped
>
> So far I have seen that I have to jump the end of long lines, press
> space and the line is broken/wrapped, but this extra typing is not very
> comfortable.

Then you have to customize `LaTeX-indent-environment-list' and remove
the entries for 'align', 'equation' and other math environments.  They
will then act like regular environments (in theory).

Best, Arash




Information forwarded to bug-auctex <at> gnu.org:
bug#28405; Package auctex. (Wed, 02 Feb 2022 13:58:02 GMT) Full text and rfc822 format available.

Message #47 received at 28405 <at> debbugs.gnu.org (full text, mbox):

From: Uwe Brauer <oub <at> mat.ucm.es>
To: Arash Esbati <arash <at> gnu.org>
Cc: Uwe Brauer <oub <at> mat.ucm.es>, auctex-devel <auctex-devel <at> gnu.org>,
 28405 <at> debbugs.gnu.org, Ikumi Keita <ikumi <at> ikumi.que.jp>
Subject: Re: bug#28405: Adding entries to LaTeX-indent-environment-list
Date: Wed, 02 Feb 2022 14:57:43 +0100
[Message part 1 (text/plain, inline)]
> Uwe Brauer <oub <at> mat.ucm.es> writes:

> I'd go back to the sender telling him his code is utterly broken and I
> will not fix it 😉

Lucky you, I can't do that 😱

> Then you have to customize `LaTeX-indent-environment-list' and remove
> the entries for 'align', 'equation' and other math environments.  They
> will then act like regular environments (in theory).

Ah well. So 

    1. I remove the entries, then the filling function will break as it
       should but its indentation is not optimal.

    2. Then I add again the entries and run the filling function and
       then the indentation works better.

That is a bit cumbersome, isn't it ☹️

Uwe 
[smime.p7s (application/pkcs7-signature, attachment)]

Information forwarded to bug-auctex <at> gnu.org:
bug#28405; Package auctex. (Thu, 03 Feb 2022 05:23:01 GMT) Full text and rfc822 format available.

Message #50 received at 28405 <at> debbugs.gnu.org (full text, mbox):

From: Ikumi Keita <ikumi <at> ikumi.que.jp>
To: Arash Esbati <arash <at> gnu.org>
Cc: Uwe Brauer <oub <at> mat.ucm.es>, 28405 <at> debbugs.gnu.org,
 auctex-devel <auctex-devel <at> gnu.org>
Subject: Re: bug#28405: Adding entries to LaTeX-indent-environment-list
Date: Thu, 03 Feb 2022 14:22:41 +0900
>>>>> Arash Esbati <arash <at> gnu.org> writes:
> Ikumi Keita <ikumi <at> ikumi.que.jp> writes:
>> With respect to math envs without alignment, e.g. "equation",
>> "displaymath" and "gather", I think there are two approaches:
>> 1. Remove them from default value of `LaTeX-indent-environment-list'.
>> Users who want to disable filling in such envs customize the option
>> to add entries such as ("equation"), ("displaymath") and so on.
>> 2. Include them in default value of `LaTeX-indent-environment-list'.
>> Users who want filling in such envs customize the option to remove
>> those entries.
>> 
>> What do you think about the above ideas?

> I'm not sure about 1.  I haven't checked but this behavior was there
> probably forever and we don't have a smart filling for equations w/o
> alignment.  Do we want to pass this to Emacs standard filling rules?

I think standard filling isn't so bad. It does the job mostly
satisfactorily, at least for me.

> About 2., we're talking about these environments, right:

>   ("equation*") ("gather") ("gather*")
>   ("gathered") ("multline") ("multline*")

> The reason I'm asking is I was also thinking about a third solution
> which can be in the styles.  There, we can check if user has removed the
> LaTeX standard environments from `LaTeX-indent-environment-list' and
> then make a decision.  Essentially in amsmath.el:

>   (when (or (assoc "equation" LaTeX-indent-environment-list)
>             (assoc "displaymath" LaTeX-indent-environment-list))
>    <add other environments to `LaTeX-indent-environment-list'>)

> What do you think, does this make sense?

Hmm, that looks a bit ad-hoc, but would work for most practical cases.
Do you plan to have similar conditional for envs with alignment such as
"array" and "eqnarray" as well? If so, it would be consistent and make
sense.

Regards,
Ikumi Keita




Information forwarded to bug-auctex <at> gnu.org:
bug#28405; Package auctex. (Thu, 03 Feb 2022 20:12:01 GMT) Full text and rfc822 format available.

Message #53 received at 28405 <at> debbugs.gnu.org (full text, mbox):

From: Arash Esbati <arash <at> gnu.org>
To: Ikumi Keita <ikumi <at> ikumi.que.jp>
Cc: Uwe Brauer <oub <at> mat.ucm.es>, 28405 <at> debbugs.gnu.org
Subject: Re: bug#28405: Adding entries to LaTeX-indent-environment-list
Date: Thu, 03 Feb 2022 21:10:55 +0100
[I've removed <auctex-devel <at> gnu.org> to reduce the X-Posting]

Ikumi Keita <ikumi <at> ikumi.que.jp> writes:

>>>>>> Arash Esbati <arash <at> gnu.org> writes:
>
>> I'm not sure about 1.  I haven't checked but this behavior was there
>> probably forever and we don't have a smart filling for equations w/o
>> alignment.  Do we want to pass this to Emacs standard filling rules?
>
> I think standard filling isn't so bad. It does the job mostly
> satisfactorily, at least for me.

That sounds good.

>> About 2., we're talking about these environments, right:
>
>>   ("equation*") ("gather") ("gather*")
>>   ("gathered") ("multline") ("multline*")
>
>> The reason I'm asking is I was also thinking about a third solution
>> which can be in the styles.  There, we can check if user has removed the
>> LaTeX standard environments from `LaTeX-indent-environment-list' and
>> then make a decision.  Essentially in amsmath.el:
>
>>   (when (or (assoc "equation" LaTeX-indent-environment-list)
>>             (assoc "displaymath" LaTeX-indent-environment-list))
>>    <add other environments to `LaTeX-indent-environment-list'>)
>
>> What do you think, does this make sense?
>
> Hmm, that looks a bit ad-hoc, but would work for most practical cases.
> Do you plan to have similar conditional for envs with alignment such as
> "array" and "eqnarray" as well? If so, it would be consistent and make
> sense.

After some reconsideration, I vote for putting all environments into
`LaTeX-indent-environment-list'.  This would give users and developers
the maximum flexibility -- my idea above is asking for unhappy customers
;-)

Best, Arash




Information forwarded to bug-auctex <at> gnu.org:
bug#28405; Package auctex. (Thu, 03 Feb 2022 21:24:02 GMT) Full text and rfc822 format available.

Message #56 received at 28405 <at> debbugs.gnu.org (full text, mbox):

From: Uwe Brauer <oub <at> mat.ucm.es>
To: Arash Esbati <arash <at> gnu.org>
Cc: Ikumi Keita <ikumi <at> ikumi.que.jp>, 28405 <at> debbugs.gnu.org,
 Uwe Brauer <oub <at> mat.ucm.es>
Subject: Re: bug#28405: Adding entries to LaTeX-indent-environment-list
Date: Thu, 03 Feb 2022 22:23:22 +0100
[Message part 1 (text/plain, inline)]
> [I've removed <auctex-devel <at> gnu.org> to reduce the X-Posting]
> Ikumi Keita <ikumi <at> ikumi.que.jp> writes:


> That sounds good.


> After some reconsideration, I vote for putting all environments into
> `LaTeX-indent-environment-list'.  This would give users and developers
> the maximum flexibility -- my idea above is asking for unhappy customers
> ;-)

Just to understand that (and sorry to nag).

If I receive an equation that is badly filled and indented, I have to
run LaTeX-fill-environment twice: 

    1. Having equation in the `LaTeX-indent-environment-list'

    2. Removing equation from `LaTeX-indent-environment-list'

Is that correct?

I can't have it both? «You can't have your cake and eat it?

Uwe 
[smime.p7s (application/pkcs7-signature, attachment)]

Information forwarded to bug-auctex <at> gnu.org:
bug#28405; Package auctex. (Thu, 03 Feb 2022 21:34:02 GMT) Full text and rfc822 format available.

Message #59 received at 28405 <at> debbugs.gnu.org (full text, mbox):

From: Arash Esbati <arash <at> gnu.org>
To: Uwe Brauer <oub <at> mat.ucm.es>
Cc: Ikumi Keita <ikumi <at> ikumi.que.jp>, 28405 <at> debbugs.gnu.org
Subject: Re: bug#28405: Adding entries to LaTeX-indent-environment-list
Date: Thu, 03 Feb 2022 22:31:48 +0100
Uwe Brauer <oub <at> mat.ucm.es> writes:

> If I receive an equation that is badly filled and indented, I have to
> run LaTeX-fill-environment twice: 
>
>     1. Having equation in the `LaTeX-indent-environment-list'
>
>     2. Removing equation from `LaTeX-indent-environment-list'
>
> Is that correct?

Can you please send a real life example of what you receive as badly
filled and indented math, and what you get after you do the exercise
above?

TIA.  Best, Arash




Information forwarded to bug-auctex <at> gnu.org:
bug#28405; Package auctex. (Thu, 03 Feb 2022 21:48:02 GMT) Full text and rfc822 format available.

Message #62 received at 28405 <at> debbugs.gnu.org (full text, mbox):

From: Uwe Brauer <oub <at> mat.ucm.es>
To: Arash Esbati <arash <at> gnu.org>
Cc: Uwe Brauer <oub <at> mat.ucm.es>, 28405 <at> debbugs.gnu.org,
 Ikumi Keita <ikumi <at> ikumi.que.jp>
Subject: Re: bug#28405: Adding entries to LaTeX-indent-environment-list
Date: Thu, 03 Feb 2022 22:47:44 +0100
[Message part 1 (text/plain, inline)]
>>> "AE" == Arash Esbati <arash <at> gnu.org> writes:

> Uwe Brauer <oub <at> mat.ucm.es> writes:
>> If I receive an equation that is badly filled and indented, I have to
>> run LaTeX-fill-environment twice: 
>> 
>> 1. Having equation in the `LaTeX-indent-environment-list'
>> 
>> 2. Removing equation from `LaTeX-indent-environment-list'
>> 
>> Is that correct?

> Can you please send a real life example of what you receive as badly
> filled and indented math, and what you get after you do the exercise
> above?

Fair enough. It turns out I have to look for one. I tried to cook up
something but that was not realistic. So most likely tomorrow.
[smime.p7s (application/pkcs7-signature, attachment)]

Information forwarded to bug-auctex <at> gnu.org:
bug#28405; Package auctex. (Sat, 05 Feb 2022 08:35:02 GMT) Full text and rfc822 format available.

Message #65 received at 28405 <at> debbugs.gnu.org (full text, mbox):

From: Ikumi Keita <ikumikeita <at> jcom.home.ne.jp>
To: Arash Esbati <arash <at> gnu.org>
Cc: Uwe Brauer <oub <at> mat.ucm.es>, 28405 <at> debbugs.gnu.org
Subject: Re: bug#28405: Adding entries to LaTeX-indent-environment-list
Date: Sat, 05 Feb 2022 17:34:06 +0900
>>>>> Arash Esbati <arash <at> gnu.org> writes:
> After some reconsideration, I vote for putting all environments into
> `LaTeX-indent-environment-list'.  This would give users and developers
> the maximum flexibility -- my idea above is asking for unhappy customers
> ;-)

All right, I'll do that. I'll consider Uwe's request after he send
example.

Bye,
Ikumi Keita




bug closed, send any further explanations to 28405 <at> debbugs.gnu.org and gojjoe <at> gmail.com Request was from Ikumi Keita <ikumi <at> ikumi.que.jp> to control <at> debbugs.gnu.org. (Sun, 06 Feb 2022 11:10:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 06 Mar 2022 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 52 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.