unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#14419: 24.3.50; ispell behaves badly with some TeX documents
@ 2013-05-18  5:21 Ivan Andrus
  2013-05-18  5:37 ` bug#14419: In comment Ivan Andrus
  2014-01-16 13:52 ` bug#14419: 24.3.50; ispell behaves badly with some TeX documents Agustin Martin
  0 siblings, 2 replies; 3+ messages in thread
From: Ivan Andrus @ 2013-05-18  5:21 UTC (permalink / raw)
  To: 14419

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





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

* bug#14419: In comment
  2013-05-18  5:21 bug#14419: 24.3.50; ispell behaves badly with some TeX documents Ivan Andrus
@ 2013-05-18  5:37 ` Ivan Andrus
  2014-01-16 13:52 ` bug#14419: 24.3.50; ispell behaves badly with some TeX documents Agustin Martin
  1 sibling, 0 replies; 3+ messages in thread
From: Ivan Andrus @ 2013-05-18  5:37 UTC (permalink / raw)
  To: 14419

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




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

* bug#14419: 24.3.50; ispell behaves badly with some TeX documents
  2013-05-18  5:21 bug#14419: 24.3.50; ispell behaves badly with some TeX documents Ivan Andrus
  2013-05-18  5:37 ` bug#14419: In comment Ivan Andrus
@ 2014-01-16 13:52 ` Agustin Martin
  1 sibling, 0 replies; 3+ messages in thread
From: Agustin Martin @ 2014-01-16 13:52 UTC (permalink / raw)
  To: 14419-done

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





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

end of thread, other threads:[~2014-01-16 13:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-18  5:21 bug#14419: 24.3.50; ispell behaves badly with some TeX documents Ivan Andrus
2013-05-18  5:37 ` bug#14419: In comment Ivan Andrus
2014-01-16 13:52 ` bug#14419: 24.3.50; ispell behaves badly with some TeX documents Agustin Martin

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