Subject: Re: bug#44318: 28.0.50; Problem with ispell/flyspell and ""enchant"" backend

From: Reuben Thomas <[email-masked]>
Date: Sun, 1 Nov 2020 22:23:44 +0000

On Sat, 31 Oct 2020 at 09:17, Eli Zaretskii <[email-masked]> wrote:

> > From: dinkonin <[email-masked]>
> > Date: Sat, 31 Oct 2020 10:37:49 +0200
> > Cc: Reuben Thomas <[email-masked]>, [email-masked]
> >
> > I totally agree with you that this is an upstream problem and I have
> reported it there. But maybe I have not
> > worded my bug correctly (my English is lacking, sorry). Enchant is
> working everywhere else on the same
> > system i.e. in AbiWord, Vim, GtkSpell and gedit. It does not work only
> in Emacs, that's why I reported it here,
> > for the benefit of other Arch users using the package and Emacs.
>
> I don't know how it succeeds working in those other environments, but
> I don't think Emacs should work around clear problems in installing
> the spell-checker.
>

I've had a bit more time to think about this now, and I think I understand
better what is going on.

First, it's pretty obvious why this isn't a problem for programs other than
Emacs: they ignore the error messages.

I think Enchant is correct to generate the errors, as it shows that it has
been mis-installed. I looked at the Arch package, and it depends on
libvoikko, so I'm surprised you're getting these errors in the first place.

However, I think Emacs should be able (like other Enchant-using programs)
to cope with this problem, particularly as all it should have to do is
ignore stderr.

I think this can be achieved by changing the definition of
ispell--call-enchant-lsmod to:

(defun ispell--call-enchant-lsmod (&rest args)
  "Call enchant-lsmod with ARGS and return the output as string."
  (with-output-to-string
    (apply #'ispell-call-process
           (replace-regexp-in-string "enchant\\(-[0-9]\\)?\\'"
                                     "enchant-lsmod\\1"
                                     ispell-program-name)
           nil '(t nil) nil args)))

(I can't see any reason to use `with-current-buffer` either; am I missing
something?)

-- 
https://rrt.sc3d.org