Subject: bug#26125: ispell fails to detect certain typos

From: Arash Esbati <[email-masked]>
Date: Thu, 16 Mar 2017 16:02:35 +0100

Leon Meier <[email-masked]> writes:

>> 1) Try $\sigma$ contradition -- it has the same effect within LaTeX
> Then ispell complains, which is its correct behavior.
>
>>
>> 2) Try \( \sigma \) contradition -- note the spaces around \sigma; same
>> effect, but ugly
> Then ispell also complains, which is also its correct behavior.
>
>>
>> 3) Eval the form in verbatim environment below and run ispell again:
>>
>> --8<---------------cut here---------------start------------->8---
>> \documentclass{article}
>>
>> \begin{document}
>>
>> \begin{verbatim}
>> (TeX-ispell-skip-setcar
>>   '(("\\\\(" . "\\\\)")))
>> \end{verbatim}
>>
>> \(\sigma\) contradition
>>
>> $\sigma$ contradition
>>
>> \end{document}
>> --8<---------------cut here---------------end--------------->8---
> I'm not quite sure what you mean. I did
> M-x eval-expression <RET>
> and pasted
> (TeX-ispell-skip-setcar '(("\\\\(" . "\\\\)")))
> into the minibuffer.
> After that, ispell complained correctly.

Yes, that is correct.  You also could have put the cursor after the last
) and hit `C-x C-e'.

>> 4) Disable the new feature by setting `TeX-ispell-extend-skip-list' to
>> nil.
> After appending
>
> (setq TeX-ispell-extend-skip-list nil)
>
> to .emacs , ispell complained correctly.
>
> Thank you, that helped.
>
> The options 1) and 2) are out of question in the long run for legacy
> latex code with \( and \) you wouldn't like to change. I wouldn't like
> to run eval-expression each time I start emacs, so 3) is out of
> question for me now.

You can put something like this in your .emacs; then Emacs does it
automatically for you:

    (with-eval-after-load "tex-ispell"
      (TeX-ispell-skip-setcar '(("\\\\(" . "\\\\)"))))

> I guess, 4) could be a current workaround for me.
>
> Note that if you replace \sigma by x (or some other Latin letter),
> ispell also complains correctly, so, per se, \( \) poses a problem
> only under certain special circumstances.

Many thanks for testing.  Indeed, this seems to be an interesting case.
At any rate, I will add the solution to tex-ispell.el.  You can use the
code above until then, and remove it once you have installed the next
version.

Best, Arash