Subject: bug#61190: 28.2; ispell personal dictionary location for hunspell engine

From: Eli Zaretskii <[email-masked]>
Date: Tue, 31 Jan 2023 15:47:30 +0200

> From: O G <[email-masked]>
> Date: Mon, 30 Jan 2023 19:53:19 -0500
> 
> The ispell package in Emacs is not using the user-specified location of
> the personal dictionary for hunspell.
> 
> In particular, neither of these two settings are being respected:
> 
> (setq ispell-personal-directory "/c/Users/xxxx/.hunspell_en_US")
> (setq ispell-cmd-args "-p /c/Users/xxxx/.hunspell_en_US")

These are incorrect settings: the native Windows build of Emacs
doesn't understand the MSYS /c/foo/bar notation.  Please use the
native Windows format "c:/Users/xxx/" or "C:\\Users\\xxx\\" instead
(both should work, but backslashes need to be escaped in Emacs
strings).

> Instead, it appears that ispell is hardwired to use the file
> %USERPROFILE%hunspell_en_US regardless of whether or not the user has
> specified another choice for their personal dictionary.
> 
> Note that a file named %USERPROFILE%hunspell_en_US is being created at
> the save prompt when adding a new spelling regardless of whether or not
> a file named .hunspell_en_US already exists in the user's home directory
> (the default file path for a personal directory) and that the Windows
> macro %USERPROFILE% is not being properly expanded either (so it becomes
> part of the dictionary name in unexpanded form).
> 
> Hunspell is the latest version (1.7.2) installed from the MINGW64 repository
> in the MYSYS2 project.  It is otherwise working just fine with Emacs
> using the following two settings:

Does it work for you as expected if you invoke Hunspell from the shell
prompt like this:

  hunspell -d en_US -p c:/Users/xxx/.hunspell_en_US SOME-FILE

(which starts Hunspell with its own text-mode user interface), and
then use the 'i' command inside Hunspell to save some words in the
personal dictionary?  (I presume that your Hunspell supports the
interactive invocation like above.)  If that doesn't save in the
correct file either, then it's a Hunspell bug, and you should report
it to the folks who develop Hunspell or those who produced the Windows
port you are using.  Because all Emacs does when you set
ispell-personal-directory is to invoke Hunspell with the "-p PDICT"
command-line argument.  If you have Process Explorer installed, you
should be able to verify that Hunspell is indeed invoked with the -p
option as above, and if that is so, then the part of Emacs and
ispell.el works correctly, and the problem is in Hunspell itself.