all messages for Emacs-related lists mirrored at yhetil.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

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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.