GNU bug report logs - #19281
11.86; environment update fails when environment name contains \

Previous Next

Package: auctex;

Reported by: Manuel Sorge <manuel.sorge <at> tu-berlin.de>

Date: Fri, 5 Dec 2014 17:38:03 UTC

Severity: normal

Tags: confirmed

Found in version 11.86

Done: Mosè Giordano <mose <at> gnu.org>

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 19281 in the body.
You can then email your comments to 19281 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#19281; Package auctex. (Fri, 05 Dec 2014 17:38:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Manuel Sorge <manuel.sorge <at> tu-berlin.de>:
New bug report received and forwarded. Copy sent to bug-auctex <at> gnu.org. (Fri, 05 Dec 2014 17:38:03 GMT) Full text and rfc822 format available.

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

From: Manuel Sorge <manuel.sorge <at> tu-berlin.de>
To: bug-auctex <at> gnu.org
Subject: 11.86; environment update fails when environment name contains \
Date: Fri, 05 Dec 2014 17:17:33 +0100
I tried to update an environment in a latex document via C-u C-c C-e or 
LaTeX-modify-environment but mistyped the name as 'theorem\'. I tried to 
correct my error via C-u C-c C-e again but I got a search failed message:

LaTeX-modify-environment: Search failed: "\\\\end{ *\\([a-zA-Z*]*\\)}"





Information forwarded to bug-auctex <at> gnu.org:
bug#19281; Package auctex. (Mon, 08 Dec 2014 18:36:02 GMT) Full text and rfc822 format available.

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

From: Mosè Giordano <mose <at> gnu.org>
To: Manuel Sorge <manuel.sorge <at> tu-berlin.de>
Cc: 19281 <at> debbugs.gnu.org, control <control <at> debbugs.gnu.org>
Subject: Re: bug#19281: 11.86; environment update fails when environment name
 contains \
Date: Mon, 8 Dec 2014 19:34:50 +0100
tag 19281 confirmed
thanks


Hi Manuel,

2014-12-05 17:17 GMT+01:00 Manuel Sorge <manuel.sorge <at> tu-berlin.de>:
>
> I tried to update an environment in a latex document via C-u C-c C-e or
> LaTeX-modify-environment but mistyped the name as 'theorem\'. I tried to
> correct my error via C-u C-c C-e again but I got a search failed message:
>
> LaTeX-modify-environment: Search failed: "\\\\end{ *\\([a-zA-Z*]*\\)}"

I can confirm the bug you reported.  Indeed, `\begin' and `\end'
accept as valid environment names macros (not your case though) and
macros with arguments, while `LaTeX-modify-environment' searches for
names matching "[a-zA-Z*]".  So, I'm not sure how to fix it: Just add
`TeX-esc' to the regexp?  Or matching everything between the opening
and the closing brace (allowing at least one level of braces)?
Suggestions welcome.

Bye,
Mosè




Added tag(s) confirmed. Request was from Mosè Giordano <mose <at> gnu.org> to control <at> debbugs.gnu.org. (Mon, 08 Dec 2014 18:36:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-auctex <at> gnu.org:
bug#19281; Package auctex. (Mon, 08 Dec 2014 20:53:02 GMT) Full text and rfc822 format available.

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

From: Mosè Giordano <mose <at> gnu.org>
To: 19281 <19281 <at> debbugs.gnu.org>
Subject: Re: bug#19281: 11.86; environment update fails when environment name
 contains \
Date: Mon, 8 Dec 2014 21:51:28 +0100
To anyone replying to my previous message: please do not CC
control <at> debbugs.gnu.org, unless you really want to send control
messages.

Thanks,
Mosè

2014-12-08 19:34 GMT+01:00 Mosè Giordano <mose <at> gnu.org>:
> tag 19281 confirmed
> thanks
>
>
> Hi Manuel,
>
> 2014-12-05 17:17 GMT+01:00 Manuel Sorge <manuel.sorge <at> tu-berlin.de>:
>>
>> I tried to update an environment in a latex document via C-u C-c C-e or
>> LaTeX-modify-environment but mistyped the name as 'theorem\'. I tried to
>> correct my error via C-u C-c C-e again but I got a search failed message:
>>
>> LaTeX-modify-environment: Search failed: "\\\\end{ *\\([a-zA-Z*]*\\)}"
>
> I can confirm the bug you reported.  Indeed, `\begin' and `\end'
> accept as valid environment names macros (not your case though) and
> macros with arguments, while `LaTeX-modify-environment' searches for
> names matching "[a-zA-Z*]".  So, I'm not sure how to fix it: Just add
> `TeX-esc' to the regexp?  Or matching everything between the opening
> and the closing brace (allowing at least one level of braces)?
> Suggestions welcome.
>
> Bye,
> Mosè




Information forwarded to bug-auctex <at> gnu.org:
bug#19281; Package auctex. (Tue, 09 Dec 2014 09:36:02 GMT) Full text and rfc822 format available.

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

From: Tassilo Horn <tsdh <at> gnu.org>
To: Mosè Giordano <mose <at> gnu.org>
Cc: Manuel Sorge <manuel.sorge <at> tu-berlin.de>, 19281 <at> debbugs.gnu.org
Subject: Re: bug#19281: 11.86;
 environment update fails when environment name contains \
Date: Tue, 09 Dec 2014 10:34:56 +0100
Mosè Giordano <mose <at> gnu.org> writes:

>> I tried to update an environment in a latex document via C-u C-c C-e
>> or LaTeX-modify-environment but mistyped the name as 'theorem\'. I
>> tried to correct my error via C-u C-c C-e again but I got a search
>> failed message:
>>
>> LaTeX-modify-environment: Search failed: "\\\\end{ *\\([a-zA-Z*]*\\)}"
>
> I can confirm the bug you reported.  Indeed, `\begin' and `\end'
> accept as valid environment names macros (not your case though) and
> macros with arguments,

Oh, indeed.

> while `LaTeX-modify-environment' searches for names matching
> "[a-zA-Z*]".  So, I'm not sure how to fix it: Just add `TeX-esc' to
> the regexp?

That and TeX-grop, TeX-grcl, and [] for optional args, no?

> Or matching everything between the opening and the closing brace
> (allowing at least one level of braces)?

Either that, or we could also rely on syntax tables.  I.e., since
`LaTeX-find-matching-end' already brings us to the end of the
environment name,

  (let ((end (point)))
    (forward-char)
    (backward-sexp)
    (forward-char)
    (buffer-substring-no-properties (point) end))

gives us the environment name.

Bye,
Tassilo




Information forwarded to bug-auctex <at> gnu.org:
bug#19281; Package auctex. (Tue, 09 Dec 2014 23:19:02 GMT) Full text and rfc822 format available.

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

From: Mosè Giordano <mose <at> gnu.org>
To: Tassilo Horn <tsdh <at> gnu.org>
Cc: Manuel Sorge <manuel.sorge <at> tu-berlin.de>, 19281 <19281 <at> debbugs.gnu.org>
Subject: Re: bug#19281: 11.86; environment update fails when environment name
 contains \
Date: Wed, 10 Dec 2014 00:17:57 +0100
[Message part 1 (text/plain, inline)]
Hi Tassilo,

2014-12-09 10:34 GMT+01:00 Tassilo Horn <tsdh <at> gnu.org>:
>> Or matching everything between the opening and the closing brace
>> (allowing at least one level of braces)?
>
> Either that, or we could also rely on syntax tables.  I.e., since
> `LaTeX-find-matching-end' already brings us to the end of the
> environment name,
>
>   (let ((end (point)))
>     (forward-char)
>     (backward-sexp)
>     (forward-char)
>     (buffer-substring-no-properties (point) end))
>
> gives us the environment name.

Good idea, except that `LaTeX-find-matching-end' fails to find the
closing brace of \end when the environment name is a macro with
arguments.  The attached patch should fix this problem.
`LaTeX-environment-name-regexp' needs to be a function because if it
were a variable it would always keep the original value, also in
buffers with different values for `TeX-grop' and `TeX-grcl' (or not?).
Probably `LaTeX-modify-environment' can be simplified following your
suggestion, the patch sketches an idea how to fix
`LaTeX-find-matching-end', but can be improved.

Bye,
Mosè
[latex-modify-environment.patch (text/x-diff, attachment)]

Information forwarded to bug-auctex <at> gnu.org:
bug#19281; Package auctex. (Wed, 10 Dec 2014 07:39:02 GMT) Full text and rfc822 format available.

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

From: Tassilo Horn <tsdh <at> gnu.org>
To: Mosè Giordano <mose <at> gnu.org>
Cc: Manuel Sorge <manuel.sorge <at> tu-berlin.de>, 19281 <19281 <at> debbugs.gnu.org>
Subject: Re: bug#19281: 11.86;
 environment update fails when environment name contains \
Date: Wed, 10 Dec 2014 08:38:04 +0100
Mosè Giordano <mose <at> gnu.org> writes:

Hi!

> 2014-12-09 10:34 GMT+01:00 Tassilo Horn <tsdh <at> gnu.org>:
>>> Or matching everything between the opening and the closing brace
>>> (allowing at least one level of braces)?
>>
>> Either that, or we could also rely on syntax tables.  I.e., since
>> `LaTeX-find-matching-end' already brings us to the end of the
>> environment name,
>>
>>   (let ((end (point)))
>>     (forward-char)
>>     (backward-sexp)
>>     (forward-char)
>>     (buffer-substring-no-properties (point) end))
>>
>> gives us the environment name.
>
> Good idea, except that `LaTeX-find-matching-end' fails to find the
> closing brace of \end when the environment name is a macro with
> arguments.

Ah, indeed.  During my testing it always stopped at
\end{\whatever{foo}|} with | being point, so I assumed that's where it's
supposed to stop, i.e., right after the environment name, not right
after the environment.

I guess it's better to also test the simple cases, not only the complex
ones. ;-)

> The attached patch should fix this problem.
> `LaTeX-environment-name-regexp' needs to be a function because if it
> were a variable it would always keep the original value, also in
> buffers with different values for `TeX-grop' and `TeX-grcl' (or not?).

Correct.  Well, it could also be a variable that's initialized in
`LaTeX-common-initialization' or so after a call to
`hack-local-variables' to apply file local variables first.  But IMO
it's better to have it as a function.

> Probably `LaTeX-modify-environment' can be simplified following your
> suggestion,

On a second thought, the syntax-table approach will fail in case the
environment name is something unbalanced like \foo[{] which is unlikely
but possible.  So better stick to the regexp-search.

> the patch sketches an idea how to fix `LaTeX-find-matching-end', but
> can be improved.

Looks good to me.

Bye,
Tassilo




Reply sent to Mosè Giordano <mose <at> gnu.org>:
You have taken responsibility. (Fri, 12 Dec 2014 16:43:03 GMT) Full text and rfc822 format available.

Notification sent to Manuel Sorge <manuel.sorge <at> tu-berlin.de>:
bug acknowledged by developer. (Fri, 12 Dec 2014 16:43:03 GMT) Full text and rfc822 format available.

Message #27 received at 19281-done <at> debbugs.gnu.org (full text, mbox):

From: Mosè Giordano <mose <at> gnu.org>
To: Tassilo Horn <tsdh <at> gnu.org>
Cc: Manuel Sorge <manuel.sorge <at> tu-berlin.de>, 19281-done <at> debbugs.gnu.org
Subject: Re: bug#19281: 11.86; environment update fails when environment name
 contains \
Date: Fri, 12 Dec 2014 17:41:21 +0100
Hi Tassilo,

2014-12-10 8:38 GMT+01:00 Tassilo Horn <tsdh <at> gnu.org>:
> Mosè Giordano <mose <at> gnu.org> writes:
>
> Hi!
>
>> 2014-12-09 10:34 GMT+01:00 Tassilo Horn <tsdh <at> gnu.org>:
>>>> Or matching everything between the opening and the closing brace
>>>> (allowing at least one level of braces)?
>>>
>>> Either that, or we could also rely on syntax tables.  I.e., since
>>> `LaTeX-find-matching-end' already brings us to the end of the
>>> environment name,
>>>
>>>   (let ((end (point)))
>>>     (forward-char)
>>>     (backward-sexp)
>>>     (forward-char)
>>>     (buffer-substring-no-properties (point) end))
>>>
>>> gives us the environment name.
>>
>> Good idea, except that `LaTeX-find-matching-end' fails to find the
>> closing brace of \end when the environment name is a macro with
>> arguments.
>
> Ah, indeed.  During my testing it always stopped at
> \end{\whatever{foo}|} with | being point, so I assumed that's where it's
> supposed to stop, i.e., right after the environment name, not right
> after the environment.
>
> I guess it's better to also test the simple cases, not only the complex
> ones. ;-)
>
>> The attached patch should fix this problem.
>> `LaTeX-environment-name-regexp' needs to be a function because if it
>> were a variable it would always keep the original value, also in
>> buffers with different values for `TeX-grop' and `TeX-grcl' (or not?).
>
> Correct.  Well, it could also be a variable that's initialized in
> `LaTeX-common-initialization' or so after a call to
> `hack-local-variables' to apply file local variables first.  But IMO
> it's better to have it as a function.
>
>> Probably `LaTeX-modify-environment' can be simplified following your
>> suggestion,
>
> On a second thought, the syntax-table approach will fail in case the
> environment name is something unbalanced like \foo[{] which is unlikely
> but possible.  So better stick to the regexp-search.
>
>> the patch sketches an idea how to fix `LaTeX-find-matching-end', but
>> can be improved.
>
> Looks good to me.

Ok, thanks, patch installed.

Bye,
Mosè




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

This bug report was last modified 10 years and 167 days ago.

Previous Next


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