GNU bug report logs - #72262
31.0.50; [PATCH] Bug in `ispell-begin-tex-skip-regexp'

Previous Next

Package: emacs;

Reported by: Arash Esbati <arash <at> gnu.org>

Date: Tue, 23 Jul 2024 20:56:02 UTC

Severity: normal

Tags: patch

Found in version 31.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

To reply to this bug, email your comments to 72262 AT debbugs.gnu.org.
There is no need to reopen the bug first.

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-gnu-emacs <at> gnu.org:
bug#72262; Package emacs. (Tue, 23 Jul 2024 20:56:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Arash Esbati <arash <at> gnu.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 23 Jul 2024 20:56:02 GMT) Full text and rfc822 format available.

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

From: Arash Esbati <arash <at> gnu.org>
To: "emacs-bugs" <bug-gnu-emacs <at> gnu.org>
Subject: 31.0.50; [PATCH] Bug in `ispell-begin-tex-skip-regexp'
Date: Tue, 23 Jul 2024 22:55:34 +0200
[Message part 1 (text/plain, inline)]
Hi all,

please consider this .tex file which is valid LaTeX code:

--8<---------------cut here---------------start------------->8---
\documentclass{article}

\newenvironment{spacetest }{\itshape}{}
\newenvironment{spacetest}{\ttfamily}{}

\begin{document}

\begin{verbatim}
(setq ispell-tex-skip-alists
      '((("\\\\document\\(class\\|style\\)" . "\\\\begin[ \t\n]*{document}"))
        (("spacetest"    . "\\\\end[ \t]*{spacetest}")
         ("verbatim\\*?" . "\\\\end[ \t]*{verbatim\\*?}"))))
\end{verbatim}

\begin{spacetest }
Thiz iz nott to be ignorrd.
\end{spacetest }

\begin{spacetest}
  Thiz iz to be ignorrd.
\end{spacetest}

\end{document}
--8<---------------cut here---------------end--------------->8---

Eval the form in the verbatim environment and do 'M-x ispell RET'.  It
doesn't find any misspelled words at all and ignores both environments
'spacetest ' and 'spacetest' where it should only ignore the latter.

This is due to unnecessary matching of whitespaces in the function
`ispell-begin-tex-skip-regexp'.  The patch attached fixes the issue.
The patch is against the master branch, but should also apply to the
release branch.  I can update it once a number is assigned to the
report.

Best, Arash
[0001-Delete-matching-of-whitespaces-in-LaTeX-env-names.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#72262; Package emacs. (Sat, 27 Jul 2024 07:23:01 GMT) Full text and rfc822 format available.

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

From: Arash Esbati <arash <at> gnu.org>
To: 72262 <at> debbugs.gnu.org
Subject: Re: bug#72262: 31.0.50; [PATCH] Bug in `ispell-begin-tex-skip-regexp'
Date: Sat, 27 Jul 2024 09:21:44 +0200
[Message part 1 (text/plain, inline)]
Arash Esbati <arash <at> gnu.org> writes:

> I can update it once a number is assigned to the report.

Here it is.
[0001-Delete-matching-of-whitespaces-in-LaTeX-env-names.patch (text/x-patch, attachment)]
[Message part 3 (text/plain, inline)]
Best, Arash

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#72262; Package emacs. (Sun, 04 Aug 2024 08:33:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Arash Esbati <arash <at> gnu.org>
Cc: 72262 <at> debbugs.gnu.org
Subject: Re: bug#72262: 31.0.50; [PATCH] Bug in `ispell-begin-tex-skip-regexp'
Date: Sun, 04 Aug 2024 11:31:45 +0300
> From: Arash Esbati <arash <at> gnu.org>
> Date: Sat, 27 Jul 2024 09:21:44 +0200
> 
> Arash Esbati <arash <at> gnu.org> writes:
> 
> > I can update it once a number is assigned to the report.
> 
> Here it is.

Thanks, but couldn't this change break someone's setup or workflows?
The matching of whitespace there seems to be on purpose, and your use
case involves customization of ispell-tex-skip-alists.  What about
users who didn't customize that or customized it in a different way?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#72262; Package emacs. (Sun, 04 Aug 2024 20:04:02 GMT) Full text and rfc822 format available.

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

From: Arash Esbati <arash <at> gnu.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 72262 <at> debbugs.gnu.org
Subject: Re: bug#72262: 31.0.50; [PATCH] Bug in `ispell-begin-tex-skip-regexp'
Date: Sun, 04 Aug 2024 22:01:07 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

> Thanks, but couldn't this change break someone's setup or workflows?

I can't currently think of a scenario where the change breaks a working
setup.

> The matching of whitespace there seems to be on purpose,

In LaTeX2e, spaces in environment names are significant, so \begin{foo}
is not equivalent to \begin{foo } or \begin{ foo }, therefore I think
the current code is wrong.

> and your use case involves customization of ispell-tex-skip-alists.
> What about users who didn't customize that or customized it in a
> different way?

The former group is not affected at all since LaTeX has no environment
names with spaces.  The latter will actually get what they're asking for
with the change I proposed, which is a follow-up to 808917b3fc.

Best, Arash




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#72262; Package emacs. (Mon, 05 Aug 2024 11:29:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Arash Esbati <arash <at> gnu.org>, Stefan Monnier <monnier <at> iro.umontreal.ca>,
 Tassilo Horn <tsdh <at> gnu.org>
Cc: 72262 <at> debbugs.gnu.org
Subject: Re: bug#72262: 31.0.50; [PATCH] Bug in `ispell-begin-tex-skip-regexp'
Date: Mon, 05 Aug 2024 14:28:09 +0300
> From: Arash Esbati <arash <at> gnu.org>
> Cc: 72262 <at> debbugs.gnu.org
> Date: Sun, 04 Aug 2024 22:01:07 +0200
> 
> Eli Zaretskii <eliz <at> gnu.org> writes:
> 
> > Thanks, but couldn't this change break someone's setup or workflows?
> 
> I can't currently think of a scenario where the change breaks a working
> setup.
> 
> > The matching of whitespace there seems to be on purpose,
> 
> In LaTeX2e, spaces in environment names are significant, so \begin{foo}
> is not equivalent to \begin{foo } or \begin{ foo }, therefore I think
> the current code is wrong.
> 
> > and your use case involves customization of ispell-tex-skip-alists.
> > What about users who didn't customize that or customized it in a
> > different way?
> 
> The former group is not affected at all since LaTeX has no environment
> names with spaces.  The latter will actually get what they're asking for
> with the change I proposed, which is a follow-up to 808917b3fc.

I know nothing about TeX, so I added two people who do, in the hope
that they could provide a more meaningful review.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#72262; Package emacs. (Wed, 14 Aug 2024 12:13:01 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Arash Esbati <arash <at> gnu.org>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 72262 <at> debbugs.gnu.org
Subject: Re: bug#72262: 31.0.50; [PATCH] Bug in `ispell-begin-tex-skip-regexp'
Date: Wed, 14 Aug 2024 08:11:45 -0400
>> The matching of whitespace there seems to be on purpose,
>
> In LaTeX2e, spaces in environment names are significant, so \begin{foo}
> is not equivalent to \begin{foo } or \begin{ foo }, therefore I think
> the current code is wrong.

Indeed, this is puzzling: I can't see why the code explicitly ignored
whitespace there.  I've never seen environment names with leading or
trailing whitespace, so it's probably not a big deal wither way, but
your patch looks right to me.


        Stefan





Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Sat, 17 Aug 2024 08:17:01 GMT) Full text and rfc822 format available.

Notification sent to Arash Esbati <arash <at> gnu.org>:
bug acknowledged by developer. (Sat, 17 Aug 2024 08:17:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: arash <at> gnu.org, 72262-done <at> debbugs.gnu.org
Subject: Re: bug#72262: 31.0.50; [PATCH] Bug in `ispell-begin-tex-skip-regexp'
Date: Sat, 17 Aug 2024 11:15:47 +0300
> From: Stefan Monnier <monnier <at> iro.umontreal.ca>
> Cc: Eli Zaretskii <eliz <at> gnu.org>,  72262 <at> debbugs.gnu.org
> Date: Wed, 14 Aug 2024 08:11:45 -0400
> 
> >> The matching of whitespace there seems to be on purpose,
> >
> > In LaTeX2e, spaces in environment names are significant, so \begin{foo}
> > is not equivalent to \begin{foo } or \begin{ foo }, therefore I think
> > the current code is wrong.
> 
> Indeed, this is puzzling: I can't see why the code explicitly ignored
> whitespace there.  I've never seen environment names with leading or
> trailing whitespace, so it's probably not a big deal wither way, but
> your patch looks right to me.

Thanks, installed on master, and closing the bug.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#72262; Package emacs. (Mon, 19 Aug 2024 08:10:02 GMT) Full text and rfc822 format available.

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

From: Tassilo Horn <tsdh <at> gnu.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Arash Esbati <arash <at> gnu.org>, 72262 <at> debbugs.gnu.org,
 Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#72262: 31.0.50; [PATCH] Bug in `ispell-begin-tex-skip-regexp'
Date: Mon, 19 Aug 2024 10:05:43 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

Hi all,

> I know nothing about TeX, so I added two people who do, in the hope
> that they could provide a more meaningful review.

Sorry for being so late.  Actually, Arash knows (La)TeX much better than
me.  I just validated his claim that spaces in environment names are
significant and its true.  So the patch is correct.

Bye,
  Tassilo




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#72262; Package emacs. (Mon, 19 Aug 2024 11:36:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Tassilo Horn <tsdh <at> gnu.org>
Cc: arash <at> gnu.org, 72262 <at> debbugs.gnu.org, monnier <at> iro.umontreal.ca
Subject: Re: bug#72262: 31.0.50; [PATCH] Bug in `ispell-begin-tex-skip-regexp'
Date: Mon, 19 Aug 2024 14:34:10 +0300
> From: Tassilo Horn <tsdh <at> gnu.org>
> Cc: Arash Esbati <arash <at> gnu.org>,  Stefan Monnier
>  <monnier <at> iro.umontreal.ca>,  72262 <at> debbugs.gnu.org
> Date: Mon, 19 Aug 2024 10:05:43 +0200
> 
> Eli Zaretskii <eliz <at> gnu.org> writes:
> 
> Hi all,
> 
> > I know nothing about TeX, so I added two people who do, in the hope
> > that they could provide a more meaningful review.
> 
> Sorry for being so late.  Actually, Arash knows (La)TeX much better than
> me.  I just validated his claim that spaces in environment names are
> significant and its true.  So the patch is correct.

Thanks for chiming in.




This bug report was last modified 19 days ago.

Previous Next


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