Subject: Re: bug#24439: ispell.el; cutom setting `ispell-library-directory'; patch

From: Laimonas Vėbra <[email-masked]>
Date: Thu, 15 Sep 2016 18:56:38 +0300

Eli Zaretskii wrote:
>> From: Laimonas Vėbra <[email-masked]>
>> Date: Wed, 14 Sep 2016 23:02:03 +0300
>>
>> On Windows if one uses cygwin ispell, then one should fix ispell LIBDIR
>> (which is not correct absolute path) relative to cygwin root by setting
>> `ispell-library-directory'. Or one also might wish to use custom
>> location of dictionaries.
>
> ispell-library-directory is not supposed to be customized by users,
> it's an internal variable set and used by ispell.el.  To change the
> location of dictionaries, users are supposed to customize
> ispell-local-dictionary-alist.  Why can't you do that instead?

I do understand, that it's internal variable, though it it useful (and i 
would say crucial) for customization. How am i suppose to customize
`ispell-local-dictionary-alist'? AFAICS dictionaries, that are added 
there, are not visible to `ispell-change-dictionary', because 
`ispell-library-directory' points to a wrong directory, where 
`ispell-valid-dictionary-list' can't find them, so they are ommited.

> That's not what I see.  What I see is that ispell-library-directory is
> set once whenever the ispell process is created, which happens only
> once in a session, or when you change your ispell dictionary.  So I

Correct: once per session. But it is redundant either, because it is 
already set before in `ispell-set-spellchecker-params', which is called
by ispell-(region word change-dictionary).

> think this is completely justified, because the user could install
> additional dictionaries before restarting ispell.

IMHO, resetting `ispell-library-directory', once it is already set, 
without changing ispell-program-name is simply redundant. It is clear 
from logic in `ispell-set-spellchecker-params'

     (unless (eq ispell-last-program-name ispell-program-name) ...)

How (re)setting `ispell-library-directory' helps user installing new 
dictionaries? It's `ispell-valid-dictionary-list' responsibility to do 
actual work, besides `ispell-library-directory' is already set (before 
launching ispell process) and is not supposed to be changed if user 
doesn't change 'ispell-program-name'.

> If the suggestions above don't solve your problems, perhaps you could
> write a batch file or a script which reported the library directory in
> the format that ispell.el expects in a native Windows build of Emacs.
> Or maybe you could switch to Hunspell or Aspell, which don't need
> ispell-library-directory at all.  A native Windows port of Hunspell is
> available (and works very well for me).

Thanks, i'll consider that, but currently i'm happy with 
`ispell-library-directory customization' and elisp that fixes it.