unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#20495: 24.5; invoking Hunspell with multiple dicts
@ 2015-05-03  8:11 Arash Esbati
  2015-05-03 19:21 ` Eli Zaretskii
  0 siblings, 1 reply; 3+ messages in thread
From: Arash Esbati @ 2015-05-03  8:11 UTC (permalink / raw)
  To: 20495

I've been `abusing' Hunspell's feature with multiple dicts through
ispell.el.  Beginning with 24.4., it stopped working and the issue
persists in 24.5.  You can produce the error with:

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

2.  Eval: 
(setq
   ispell-local-dictionary-alist
   '((nil "[A-Za-z]" "[^A-Za-z]" "[']" nil
      ("-d" "en_US")
      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' which says:

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

Eli kindly explained to me here
<http://thread.gmane.org/gmane.emacs.help/104130> that Hunspell does not
support multiple languages, but it looks like a bug in `ispell.el'.

Best, Arash





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

* bug#20495: 24.5; invoking Hunspell with multiple dicts
  2015-05-03  8:11 bug#20495: 24.5; invoking Hunspell with multiple dicts Arash Esbati
@ 2015-05-03 19:21 ` Eli Zaretskii
  2015-08-22 14:29   ` Eli Zaretskii
  0 siblings, 1 reply; 3+ messages in thread
From: Eli Zaretskii @ 2015-05-03 19:21 UTC (permalink / raw)
  To: Arash Esbati; +Cc: 20495

> From: Arash Esbati <esbati@gmx.de>
> Date: Sun, 03 May 2015 10:11:17 +0200
> 
> Eli kindly explained to me here
> <http://thread.gmane.org/gmane.emacs.help/104130> that Hunspell does not
> support multiple languages, but it looks like a bug in `ispell.el'.

Actually, I see that I was mistaken: the code does try to load each
dictionary in turn with its affix file.  Nevertheless, I'm quite sure
such a combination misfired for me at some point; perhaps there's a
bug, or maybe ispell.el is the culprit, since it doesn't currently
support this mode (AFAIK).

In any case, the reaction of ispell.el in this case needs to be
improved.





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

* bug#20495: 24.5; invoking Hunspell with multiple dicts
  2015-05-03 19:21 ` Eli Zaretskii
@ 2015-08-22 14:29   ` Eli Zaretskii
  0 siblings, 0 replies; 3+ messages in thread
From: Eli Zaretskii @ 2015-08-22 14:29 UTC (permalink / raw)
  To: esbati; +Cc: 20495-done

> Date: Sun, 03 May 2015 22:21:18 +0300
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: 20495@debbugs.gnu.org
> 
> > From: Arash Esbati <esbati@gmx.de>
> > Date: Sun, 03 May 2015 10:11:17 +0200
> > 
> > Eli kindly explained to me here
> > <http://thread.gmane.org/gmane.emacs.help/104130> that Hunspell does not
> > support multiple languages, but it looks like a bug in `ispell.el'.
> 
> Actually, I see that I was mistaken: the code does try to load each
> dictionary in turn with its affix file.  Nevertheless, I'm quite sure
> such a combination misfired for me at some point; perhaps there's a
> bug, or maybe ispell.el is the culprit, since it doesn't currently
> support this mode (AFAIK).
> 
> In any case, the reaction of ispell.el in this case needs to be
> improved.

I've now modified ispell.el to support invocation of Hunspell with
multiple dictionaries.  To see how it work, you will need to invoke an
additional command ispell-hunspell-add-multi-dic, before you attempt
to change the ispell dictionary to the form DICT1,DICT2,...  This is
because ispell.el relies heavily on the assumption that any dictionary
admissible as argument to ispell-change-dictionary must be mentioned
in ispell-dictionary-alist or ispell-local-dictionary-alist.  Since
it's impractical to add to ispell-dictionary-alist all the possible
combinations of all the installed dictionaries, I instead provided a
command to do that manually on the need-to basis.

Note that the argument to both ispell-change-dictionary and
ispell-hunspell-add-multi-dic _must_ be in the form of a list of
_existing_ dictionary names (or their aliases) separated by a comma.
That is, you cannot use something like "deutsch8+american", but should
use "de_DE,en_US" instead.

Initial testing indicates that using this feature works for
spell-checking text written in different languages, although the list
of the proposed corrections are sometimes incomplete.  But I think
this is due to some problems in Hunspell itself, not in Emacs.

I'm closing this bug.  Feel free to reopen if there are left-overs, or
file a new bug about whatever problems you still see.





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

end of thread, other threads:[~2015-08-22 14:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-03  8:11 bug#20495: 24.5; invoking Hunspell with multiple dicts Arash Esbati
2015-05-03 19:21 ` Eli Zaretskii
2015-08-22 14:29   ` Eli Zaretskii

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