unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Ivan Andrus <darthandrus@gmail.com>
To: 14419@debbugs.gnu.org
Subject: bug#14419: 24.3.50; ispell behaves badly with some TeX documents
Date: Fri, 17 May 2013 23:21:26 -0600	[thread overview]
Message-ID: <273F0CF4-1050-4BEB-A005-5707AF9961BA@gmail.com> (raw)

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





             reply	other threads:[~2013-05-18  5:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-18  5:21 Ivan Andrus [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=273F0CF4-1050-4BEB-A005-5707AF9961BA@gmail.com \
    --to=darthandrus@gmail.com \
    --cc=14419@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).