Subject: bug#7781: hunspell and latex-mode

From: Eli Zaretskii <[email-masked]>
Date: Tue, 29 Apr 2014 18:25:31 +0300

> From: Peter Münster <[email-masked]>
> Cc: [email-masked],  [email-masked]
> Date: Tue, 29 Apr 2014 16:30:07 +0200
> 
> On Tue, Apr 29 2014, Eli Zaretskii wrote:
> 
> > (I have no idea why visiting the same file in Text mode avoids the
> > problem.  The only difference is that in Text mode, ispell.el does not
> > skip the first 2 lines, but instead submits them to Hunspell.
> 
> No. In latex-mode, emacs switches hunspell into TeX-mode with the "+".

It does both, evidently.  Compare this part of your debug output (in
LaTeX buffer):

  ispell-region: First skip: \documentclass at (pos,line,column): (1,1,0).
  ispell-region: Continue spell-checking with hunspell and default dictionary...
  ispell-region: string pos (41->41), eol: 45, [in-comment]: [nil], [add-comment]: [nil], [string]: [nil]
  ispell-region: string pos (42->45), eol: 45, [in-comment]: [nil], [add-comment]: [nil], [string]: [^bla
  ]

with this (in Text buffer):

  ispell-region: string pos (1->24), eol: 24, [in-comment]: [nil], [add-comment]: [nil], [string]: [^\documentclass{article}
  ]
  ispell-region: string pos (24->24), eol: 41, [in-comment]: [nil], [add-comment]: [nil], [string]: [nil]
  ispell-region: string pos (25->41), eol: 41, [in-comment]: [nil], [add-comment]: [nil], [string]: [^\begin{document}
  ]
  ispell-region: string pos (41->41), eol: 45, [in-comment]: [nil], [add-comment]: [nil], [string]: [nil]
  ispell-region: string pos (42->45), eol: 45, [in-comment]: [nil], [add-comment]: [nil], [string]: [^bla
  ]
  ispell-region: string pos (45->45), eol: 60, [in-comment]: [nil], [add-comment]: [nil], [string]: [nil]
  ispell-region: string pos (46->60), eol: 60, [in-comment]: [nil], [add-comment]: [nil], [string]: [^\end{document}
  ]

As you see, in the second case, the TeX directives are also sent to
Hunspell for checking, while in the first case they are not.