unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* 24.5.; invoking hunspell with multiple dicts
@ 2015-05-01  9:58 Arash Esbati
  2015-05-01 15:03 ` Eli Zaretskii
  0 siblings, 1 reply; 8+ messages in thread
From: Arash Esbati @ 2015-05-01  9:58 UTC (permalink / raw)
  To: help-gnu-emacs

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



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: 24.5.; invoking hunspell with multiple dicts
  2015-05-01  9:58 24.5.; invoking hunspell with multiple dicts Arash Esbati
@ 2015-05-01 15:03 ` Eli Zaretskii
  2015-05-01 15:33   ` Arash Esbati
  0 siblings, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2015-05-01 15:03 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Arash Esbati <esbati@gmx.de>
> Date: Fri, 01 May 2015 11:58:43 +0200
> 
> 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")))

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".



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: 24.5.; invoking hunspell with multiple dicts
  2015-05-01 15:03 ` Eli Zaretskii
@ 2015-05-01 15:33   ` Arash Esbati
  2015-05-01 17:42     ` Eli Zaretskii
  0 siblings, 1 reply; 8+ messages in thread
From: Arash Esbati @ 2015-05-01 15:33 UTC (permalink / raw)
  To: help-gnu-emacs

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: 24.5.; invoking hunspell with multiple dicts
  2015-05-01 15:33   ` Arash Esbati
@ 2015-05-01 17:42     ` Eli Zaretskii
  2015-05-02 20:25       ` Arash Esbati
  0 siblings, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2015-05-01 17:42 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Arash Esbati <esbati@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.)




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: 24.5.; invoking hunspell with multiple dicts
  2015-05-01 17:42     ` Eli Zaretskii
@ 2015-05-02 20:25       ` Arash Esbati
  2015-05-03 14:40         ` Eli Zaretskii
  0 siblings, 1 reply; 8+ messages in thread
From: Arash Esbati @ 2015-05-02 20:25 UTC (permalink / raw)
  To: help-gnu-emacs

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: 24.5.; invoking hunspell with multiple dicts
  2015-05-02 20:25       ` Arash Esbati
@ 2015-05-03 14:40         ` Eli Zaretskii
  2015-05-04 19:57           ` Arash Esbati
  0 siblings, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2015-05-03 14:40 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Arash Esbati <esbati@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?




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: 24.5.; invoking hunspell with multiple dicts
  2015-05-03 14:40         ` Eli Zaretskii
@ 2015-05-04 19:57           ` Arash Esbati
  2015-05-05  2:33             ` Eli Zaretskii
  0 siblings, 1 reply; 8+ messages in thread
From: Arash Esbati @ 2015-05-04 19:57 UTC (permalink / raw)
  To: help-gnu-emacs

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




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: 24.5.; invoking hunspell with multiple dicts
  2015-05-04 19:57           ` Arash Esbati
@ 2015-05-05  2:33             ` Eli Zaretskii
  0 siblings, 0 replies; 8+ messages in thread
From: Eli Zaretskii @ 2015-05-05  2:33 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Arash Esbati <esbati@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.



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-05-05  2:33 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-01  9:58 24.5.; invoking hunspell with multiple dicts Arash Esbati
2015-05-01 15:03 ` Eli Zaretskii
2015-05-01 15:33   ` Arash Esbati
2015-05-01 17:42     ` Eli Zaretskii
2015-05-02 20:25       ` Arash Esbati
2015-05-03 14:40         ` Eli Zaretskii
2015-05-04 19:57           ` Arash Esbati
2015-05-05  2:33             ` Eli Zaretskii

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).