Subject: Re: bug#17742: Acknowledgement (Support for enchant?)

From: Eli Zaretskii <[email-masked]>
Date: Tue, 13 Dec 2016 18:37:12 +0200

> From: Reuben Thomas <[email-masked]>
> Date: Tue, 13 Dec 2016 00:53:47 +0000
> Cc: [email-masked]
> 
>  Thanks. Note that this should not only list the installed
>  dictionaries, but also deduce the suitable values of CASECHARS and
>  NOT-CASECHARS for each dictionary.
> 
>  ​Thanks for the tip.
> 
> ​In fact, it proves to be impossible to deduce suitable values currently, so I set defaults. Enchant will need
> changes to support this (unless one finds the provider for each dictionary and uses ispell.el's existing
> back-end-specific code, but this is a nasty solution). This simple solution gets the correct encoding at least
> (Enchant is always utf8), and hence fixes the misalignment errors.
> [...]
> +(defun ispell-find-enchant-dictionaries ()
> +  "Find Enchant's dictionaries, and record in `ispell-enchant-dictionary-alist'."
> +  (let* ((dictionaries
> +	  (split-string
> +	   (with-temp-buffer
> +	     (ispell-call-process ispell-program-name nil t nil "-D")
> +	     (buffer-string))))
> +         (found
> +          (mapcar #'(lambda (lang)
> +                      `(,lang "[[:alpha:]]" "[^[:alpha:]]" "['.’-]" t nil nil utf-8))
> +                  dictionaries)))

I'm sorry, I don't think this is good enough for any language but
English.  I looked at a few Hunspell dictionaries I have, and almost
all of them have some non-[:alpha:] characters in what becomes
CASECHARS when ispell.el sets up itself for that dictionary.  So this
seems to be really important for correct spell-checking of almost any
language.  Moreover, these settings must be in sync with the words in
the dictionary, so it isn't just some general setting determined by
the dictionary's language, it must come from the dictionary or its
authors.

I understand that Enchant doesn't yet support these features, but in
that case we must provide our users with some way of customizing these
settings, we cannot silently use defaults that are most probably
inappropriate, even if they are 90% correct.

Do the dictionaries used by Enchant really fail to provide this
information?  Aren't they Aspell dictionaries or similar?