Subject: bug#69703: Ispell process restarted too often

From: Eli Zaretskii <[email-masked]>
Date: Sun, 10 Mar 2024 19:51:20 +0200

> From: Juri Linkov <[email-masked]>
> Cc: [email-masked]
> Date: Sun, 10 Mar 2024 19:10:19 +0200
> 
> > If the speller process is killed each time before starting a new one,
> > how come there's more than just one running at any given time?  IOW,
> > how come you have "hundreds of hunspell processes" in memory?  Does
> > killing a hunspell process fail for some reason?
> 
> Actually, hundreds were when I tried to use buffer-local ispell-process
> because then ispell-internal-change-dictionary didn't kill ispell-process
> but ispell-init-process created new processes.
> 
> But with the default configuration there are "only" a dozen of processes.

That's also unexpected.  There should be only one.

> I guess one process per buffer.  And this is even in case when ispell-process
> is NOT buffer-local.  I noticed that all these processes are created
> after loading the desktop buffers.

Please show a reproduction recipe, as I didn't know this is possible.

> But with the default configuration ispell-process is killed and started
> "only" on switching buffers that is very annoying since most of the time
> I see these messages in the echo area:
> 
>   Ispell process killed
>   Starting new Ispell process /usr/bin/hunspell ...
>   Ispell process killed
>   Starting new Ispell process /usr/bin/hunspell ...
>   Ispell process killed
>   Starting new Ispell process /usr/bin/hunspell ...

If the problem is with the messages, it can be easily solved by adding
some optional feature.  But I understand there are more urgent issues,
so let's discuss those first, okay?

> > Not easily, AFAIR.  But I don't think I understand the nature of the
> > problem you are experiencing, see above.
> 
> The nature of the problem is the inability of ispell.el to maintain
> multiple processes with different dictionaries simultaneously
> that is required by flyspell-mode.
> 
> What is needed here is a hash of processes where the key is
> the ispell program name and its dictionary arguments.

Feel free to submit patches for that, and thanks.  (But didn't you
just complain about one speller process per buffer?)