GNU bug report logs - #14419
24.3.50; ispell behaves badly with some TeX documents

Previous Next

Package: emacs;

Reported by: Ivan Andrus <darthandrus <at> gmail.com>

Date: Sat, 18 May 2013 05:22:02 UTC

Severity: normal

Merged with 13577

Found in version 24.3.50

Done: Agustin Martin <agustin.martin <at> hispalinux.es>

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 14419 in the body.
You can then email your comments to 14419 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-gnu-emacs <at> gnu.org:
bug#14419; Package emacs. (Sat, 18 May 2013 05:22:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Ivan Andrus <darthandrus <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 18 May 2013 05:22:03 GMT) Full text and rfc822 format available.

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

From: Ivan Andrus <darthandrus <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3.50; ispell behaves badly with some TeX documents
Date: Fri, 17 May 2013 23:21:26 -0600
ispell can overlook misspellings and (more annoyingly though easier to 
detect) can start spell checking everything in math mode.


1. emacs -Q

2. Edit the following document in latex-mode (built in or AUCTeX):


% \documentclass[12pt,draft,a4paper]{report}
\documentclass[12pt,a4paper]{report}

\begin{document}

Representation theory concerns itself with the cases when $Y$ is the general linear group $\GL_{n}(k)$, for some field $k$.

spelling is basd $badmath$ here

\end{document}


3. Run ispell-buffer

4. It asks you to correct the word badmath.  This is in math mode and
  should be skipped.  Moreover, it missed basd outside of math mode.

5. Delete the commented documentclass line (or move it after the other)
  and things work as they are supposed to.


I ran ispell-buffer-with-debug and it seems that it skips the region
starting with \documentclass and ending with \begin{document}, but since
there was a comment before it the first line gets treated as a comment.
This is bad in and of itself if that's what's happening.  However,
because the _ in $\GL_{n}(k)$ matches the final element of
`ispell-skip-region-alist' (not sure what the purpose of that is), the
first part of the line is a comment.  That last part of the line, namely

{n}(k)$, for some field $k$.

is the first line that the spell checker sees as not a comment and
therefore it gets confused about what is math and what isn't.  Other
cases of skipping in comments can also lead to bad scenarios.  For
example in the case below no misspellings are found:


% \addcontentsline{1}{2}
spelling is basd $badmath$ here.


Perhaps it could be fixed by a small change to ispell-region to test if
the skip region is in a comment and if so, not skip that region since
comments can contain all sorts of malformed TeX.  I would try this, but
I couldn't find a canonical way to test if point is inside a comment.
Feel free to point me to one and I'll give it a shot.

-Ivan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#14419; Package emacs. (Sat, 18 May 2013 05:38:01 GMT) Full text and rfc822 format available.

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

From: Ivan Andrus <darthandrus <at> gmail.com>
To: 14419 <at> debbugs.gnu.org
Subject: In comment
Date: Fri, 17 May 2013 23:37:22 -0600
Okay, I realized I said something stupid after I sent the bug report.  In ispell-region itself it checks if the point is in a comment, so that is the "canonical method".  I'll have to read through it some more when I'm less tired to see if I can fix the problem.

-Ivan



Forcibly Merged 13577 14419. Request was from Agustin Martin <agustin.martin <at> hispalinux.es> to control <at> debbugs.gnu.org. (Thu, 16 Jan 2014 13:53:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#14419; Package emacs. (Thu, 16 Jan 2014 13:53:02 GMT) Full text and rfc822 format available.

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

From: Agustin Martin <agustin.martin <at> hispalinux.es>
To: 14419-done <at> debbugs.gnu.org
Subject: Re: bug#14419: 24.3.50; ispell behaves badly with some TeX documents
Date: Thu, 16 Jan 2014 14:52:15 +0100
forcemerge 13577 14419
thanks

On Fri, May 17, 2013 at 11:21:26PM -0600, Ivan Andrus wrote:
> ispell can overlook misspellings and (more annoyingly though easier to 
> detect) can start spell checking everything in math mode.
> 
> 
> 1. emacs -Q
> 
> 2. Edit the following document in latex-mode (built in or AUCTeX):
> 
> 
> % \documentclass[12pt,draft,a4paper]{report}
> \documentclass[12pt,a4paper]{report}
> 
> \begin{document}
> 
> Representation theory concerns itself with the cases when $Y$ is the general linear group $\GL_{n}(k)$, for some field $k$.
> 
> spelling is basd $badmath$ here
> 
> \end{document}
> 
> 
> 3. Run ispell-buffer
> 
> 4. It asks you to correct the word badmath.  This is in math mode and
>   should be skipped.  Moreover, it missed basd outside of math mode.
> 
> 5. Delete the commented documentclass line (or move it after the other)
>   and things work as they are supposed to.

Also fixed (in trunk) by commit r116025. Indeed it is the same problem. 
Closing bug report and merging both.

Regards,

-- 
Agustin




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 14 Feb 2014 12:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 11 years and 179 days ago.

Previous Next


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