Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

24.5.; invoking hunspell with multiple dicts

13 views
Skip to first unread message

Arash Esbati

unread,
May 1, 2015, 9:30:33 AM5/1/15
to help-gn...@gnu.org
I use hunspell with multiple dicts through ispell.el. Beginning with
24.4., it stopped working and the issue persists in 24.5. The recipe to
produce the error:

1. Start emacs with
emacs --eval '(setq debug-on-error t)' -Q &

2. Eval the following:

(setq ispell-program-name "hunspell")

(setq
ispell-local-dictionary-alist
'((nil "[A-Za-z]" "[^A-Za-z]" "[']" nil
("-d" "en_US")
nil iso-8859-1)
("american" "[A-Za-z]" "[^A-Za-z]" "[']" nil
("-d" "en_US")
nil iso-8859-1)
("deutsch8"
"[a-zA-Z\304\326\334\344\366\337\374]"
"[^a-zA-Z\304\326\334\344\366\337\374]" "[-'=~\"]" t
("-d" "de_DE")
nil iso-8859-1)
("deutsch8+american"
"[a-zA-Z\304\326\334\344\366\337\374]"
"[^a-zA-Z\304\326\334\344\366\337\374]" "[']" t
("-d" "de_DE,en_US")
nil iso-8859-1)))

(global-set-key "\C-cia"
'(lambda ()
(interactive)
(ispell-change-dictionary "deutsch8+american")))

3. Hit `C-c i a' followed by `M-x ispell RET'

The result is:
--8<---------------cut here---------------start------------->8---
Debugger entered--Lisp error: (error "ispell-phaf: No matching entry for deutsch8+american.
")
signal(error ("ispell-phaf: No matching entry for deutsch8+american.\n"))
error("ispell-phaf: No matching entry for %s.\n" "deutsch8+american")
ispell-parse-hunspell-affix-file("deutsch8+american")
ispell-hunspell-fill-dictionary-entry("deutsch8+american")
ispell-start-process()
ispell-init-process()
ispell-buffer-local-words()
ispell-accept-buffer-local-defs()
ispell-region(1 24666)
ispell-buffer()
ispell()
call-interactively(ispell record nil)
command-execute(ispell record)
execute-extended-command(nil "ispell")
call-interactively(execute-extended-command nil nil)
command-execute(execute-extended-command)
--8<---------------cut here---------------end--------------->8---

It works if I shadow the current `ispell.el' with the one distributed
with Emacs 24.3. Any idea? TIA.

--
Arash Esbati

Eli Zaretskii

unread,
May 1, 2015, 11:04:30 AM5/1/15
to help-gn...@gnu.org
> From: Arash Esbati <esb...@gmx.de>
> Date: Fri, 01 May 2015 11:58:43 +0200
You cannot use Hunspell with multiple dictionaries, unless they all
use the same *.aff file. Otherwise, you will get a speller that will
mist mis-spelled words, because these mis-spelled words will look as
correct spellings according to the other language.

IOW, this feature of Hunspell is for using several dictionaries for
the same language, like if you want to use a dictionary of medicinal
terms in addition to the general vocabulary.

In any case, the correct the syntax for using several dictionaries is
dict1,dict2,dict3,..., i.e. use commas.

> Debugger entered--Lisp error: (error "ispell-phaf: No matching entry for deutsch8+american.
> ")

All of the above notwithstanding, this error message does indicate a
bug, so please submit a bug report by "M-x report-emacs-bug RET".

Arash Esbati

unread,
May 1, 2015, 11:35:14 AM5/1/15
to help-gn...@gnu.org
Eli Zaretskii <eliz <at> gnu.org> writes:

[...]

> IOW, this feature of Hunspell is for using several dictionaries for
> the same language, like if you want to use a dictionary of medicinal
> terms in addition to the general vocabulary.

Thanks for your response and clarification. I read this in hunspell's man page

−d en_US,en_geo,en_med,de_DE,de_med

and just adapted it. Obviously, I've been abusing that feature for a long
time now, but it worked quite well ;-)

> In any case, the correct the syntax for using several dictionaries is
> dict1,dict2,dict3,..., i.e. use commas.

Yes, I have that in

> ("deutsch8+american"
> "[a-zA-Z\304\326\334\344\366\337\374]"
> "[^a-zA-Z\304\326\334\344\366\337\374]" "[']" t
> ("-d" "de_DE,en_US")

^^^^^^^^^^^^^^^^^^


> > Debugger entered--Lisp error: (error "ispell-phaf: No matching entry for
deutsch8+american.
> > ")
>
> All of the above notwithstanding, this error message does indicate a
> bug, so please submit a bug report by "M-x report-emacs-bug RET".

Will do so.

While we're at it: I never managed to get the `OTHERCHARS' feature work with
hunspell. I.e.,

> (setq
> ispell-local-dictionary-alist
> '((nil "[A-Za-z]" "[^A-Za-z]" "[']" nil
> ("-d" "en_US")
> nil iso-8859-1)

> ("deutsch8"
> "[a-zA-Z\304\326\334\344\366\337\374]"
> "[^a-zA-Z\304\326\334\344\366\337\374]"
> "[-'=~\"]" t

^^^^^^^^
> ("-d" "de_DE")
> nil iso-8859-1)))

This is very useful when writing German text with LaTeX. Any idea?

Thanks! Best, Arash

Eli Zaretskii

unread,
May 1, 2015, 1:42:54 PM5/1/15
to help-gn...@gnu.org
> From: Arash Esbati <esb...@gmx.de>
> Date: Fri, 1 May 2015 15:33:07 +0000 (UTC)
>
> > IOW, this feature of Hunspell is for using several dictionaries for
> > the same language, like if you want to use a dictionary of medicinal
> > terms in addition to the general vocabulary.
>
> Thanks for your response and clarification. I read this in hunspell's man page
>
> −d en_US,en_geo,en_med,de_DE,de_med
>
> and just adapted it. Obviously, I've been abusing that feature for a long
> time now, but it worked quite well ;-)

I used it as well, until I bumped into a weird case where Hunspell
missed a mistake, and then suggested strange replacements in another
case. Then I read the source code, and figured out how this works.
It cannot work with different languages.

> While we're at it: I never managed to get the `OTHERCHARS' feature work with
> hunspell. I.e.,
>
> > (setq
> > ispell-local-dictionary-alist
> > '((nil "[A-Za-z]" "[^A-Za-z]" "[']" nil
> > ("-d" "en_US")
> > nil iso-8859-1)
> > ("deutsch8"
> > "[a-zA-Z\304\326\334\344\366\337\374]"
> > "[^a-zA-Z\304\326\334\344\366\337\374]"
> > "[-'=~\"]" t
> ^^^^^^^^
> > ("-d" "de_DE")
> > nil iso-8859-1)))
>
> This is very useful when writing German text with LaTeX. Any idea?

You shouldn't need this with kind of customization with Emacs 24.4 and
later. That code which signals an error in your case figures
OTHERCHARS automatically. (It also figures out all the rest.)


Arash Esbati

unread,
May 2, 2015, 4:25:39 PM5/2/15
to help-gn...@gnu.org
Eli Zaretskii <eliz <at> gnu.org> writes:

> You shouldn't need this with kind of customization with Emacs 24.4 and
> later. That code which signals an error in your case figures
> OTHERCHARS automatically. (It also figures out all the rest.)

Tried it with `ispell.el' shipped with 24.5. like this:

1. emacs --eval '(setq debug-on-error t)' -Q &

2. Open a simple LaTeX file:

\documentclass{article}
\usepackage[ngerman]{babel}
Schönheit, Schön"=heit.
\end{document}

3. `M-x ispell-change-dictionary RET german8 RET', marking `Schön"=heit'
and `M-x ispell-region' gives me the following:
--8<---------------cut here---------------start------------->8---
Debugger entered--Lisp error: (error "Ispell misalignment: word `heit' point
74; probably incompatible versions")
signal(error ("Ispell misalignment: word `heit' point 74; probably
incompatible versions"))
error("Ispell misalignment: word `%s' point %d; probably incompatible
versions" "heit" 74)
ispell-process-line("^Schön\"=heit\n" nil)
ispell-region(66 77)
call-interactively(ispell-region record nil)
command-execute(ispell-region record)
execute-extended-command(nil "ispell-region")


call-interactively(execute-extended-command nil nil)
command-execute(execute-extended-command)
--8<---------------cut here---------------end--------------->8---

I'm not sure if I've got bitten by the bug discussed and fixed here:

http://sourceforge.net/p/hunspell/bugs/185/

I have Hunspell 1.3.3. installed.

Best, Arash

Eli Zaretskii

unread,
May 3, 2015, 10:40:57 AM5/3/15
to help-gn...@gnu.org
> From: Arash Esbati <esb...@gmx.de>
> Date: Sat, 2 May 2015 20:25:19 +0000 (UTC)
>
> Eli Zaretskii <eliz <at> gnu.org> writes:
>
> > You shouldn't need this with kind of customization with Emacs 24.4 and
> > later. That code which signals an error in your case figures
> > OTHERCHARS automatically. (It also figures out all the rest.)
>
> Tried it with `ispell.el' shipped with 24.5. like this:
>
> 1. emacs --eval '(setq debug-on-error t)' -Q &
>
> 2. Open a simple LaTeX file:
>
> \documentclass{article}
> \usepackage[ngerman]{babel}
> Schönheit, Schön"=heit.
> \end{document}
>
> 3. `M-x ispell-change-dictionary RET german8 RET', marking `Schön"=heit'
> and `M-x ispell-region' gives me the following:
> --8<---------------cut here---------------start------------->8---
> Debugger entered--Lisp error: (error "Ispell misalignment: word `heit' point
> 74; probably incompatible versions")

This doesn't happen to me.

> I'm not sure if I've got bitten by the bug discussed and fixed here:
>
> http://sourceforge.net/p/hunspell/bugs/185/

Quite possibly. I use a patched Hunspell 1.3.2 where all the known
bugs were fixed, including this one.

I suggest to find a fixed Hunspell somewhere. What OS are you on?


Arash Esbati

unread,
May 4, 2015, 3:57:21 PM5/4/15
to help-gn...@gnu.org
Eli Zaretskii <eliz <at> gnu.org> writes:

> From: Arash Esbati <esbati <at> gmx.de>

> > I'm not sure if I've got bitten by the bug discussed and fixed here:
> >
> > http://sourceforge.net/p/hunspell/bugs/185/
>
> Quite possibly. I use a patched Hunspell 1.3.2 where all the known
> bugs were fixed, including this one.
>
> I suggest to find a fixed Hunspell somewhere. What OS are you on?

I'm on Win7 64bit with msys2. I am aware of your `ezwinports' and I tried
your Hunspell once, but could not integrate it properly into my msys2
environment. I will give it a new try.

Best, Arash


Eli Zaretskii

unread,
May 4, 2015, 10:33:17 PM5/4/15
to help-gn...@gnu.org
> From: Arash Esbati <esb...@gmx.de>
> Date: Mon, 4 May 2015 19:57:05 +0000 (UTC)
>
> > Quite possibly. I use a patched Hunspell 1.3.2 where all the known
> > bugs were fixed, including this one.
> >
> > I suggest to find a fixed Hunspell somewhere. What OS are you on?
>
> I'm on Win7 64bit with msys2. I am aware of your `ezwinports' and I tried
> your Hunspell once, but could not integrate it properly into my msys2
> environment. I will give it a new try.

I'm not sure how MSYS2 environment comes into play here. All you need
is for Hunspell to be on PATH, for Emacs to invoke it, that's all.

0 new messages