bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#32319: 27.0.50; flyspell-mode error on start


From: Eric Abrahamsen
Subject: bug#32319: 27.0.50; flyspell-mode error on start
Date: Wed, 01 Aug 2018 12:51:54 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

On 08/01/18 09:00 AM, Eli Zaretskii wrote:
>> From: Eric Abrahamsen <address@hidden>
>> Date: Tue, 31 Jul 2018 19:03:26 -0700
>> 
>> But! This was a false alarm: the problem is a bug in the hunspell_en
>> package for Arch linux, which is missing some symlinks, and causing
>> several other programs to fail: 
>> 
>> https://bugs.archlinux.org/task/59401
>
> So the problem was that the files en_US.*, which spell-checking was
> supposed to use, didn't exist, is that right?

That's correct. My LANG is set to en_US.UTF-8, so I guess hunspell
automatically tries to load the en_US dictionary. With the correct
symlink in place, "hunspell -D" produces:

SEARCH PATH:
.:: <elided>
AVAILABLE DICTIONARIES
/usr/share/hunspell/en_TT
<more>
LOADED DICTIONARY:
/usr/share/hunspell/en_US.aff
/usr/share/hunspell/en_US.dic

`ispell-find-hunspell-dictionaries' cycles over each line of the above
output and looks for "\\.aff$" (ispell.el:1120). If it finds it, the
local variable `hunspell-default-dictionary' is set from that value,
which eventually finds its way into `ispell-hunspell-dictionary-alist',
and things proceed normally from there.

If the symlink is not present, the "hunspell -D" output looks like:

SEARCH PATH:.:: <elided>
AVAILABLE DICTIONARIES
/usr/share/hunspell/en_TT
<more>
Can't open affix or dictionary files for dictionary named "en_US".

IOW, there's no line that matches "\\.aff$", and
`hunspell-default-dictionary' is never set, and the error is raised in
line 1177, where it's assumed that that variable has a value.

So things go wrong pretty early on, as soon as Hunspell fails to load a
dictionary.

>> It might have been nice if ispell allowed the real error to reach me
>> (during edebugging I did see something like "no affix file found for
>> "en_US""), but I suppose it isn't a big deal.
>
> At some point in the initialization, ispell.el looks for the
> dictionary file, and if not found, falls back to a user option (which
> was nil in your case).  Can you spot where both are nil, and propose a
> patch in that place to display a warning or error message?

I suppose if the user has asked to use Hunspell, and Hunspell has failed
to load a dictionary, we should bail with a warning at that stage?

Alternately, I tried wrapping lines 1176-1180, at the bottom of
`ispell-find-hunspell-dictionaries', in a (when
hunspell-default-dictionary ...), so that essentially nothing gets set.
When I then ran `ispell-buffer', I got:

Can't open affix or dictionary files for dictionary named "en_US".

Which is the error returned by hunspell itself, and useful information.

What I didn't test was whether having a user option in place, specifying
a dictionary to use, would prevent even that error from being signaled.
Mostly because I don't know which option that would be -- I find the
proliferation of dictionary-holding variables pretty confusing. But I
suppose the ideal situation would be: having a valid option set would
swallow the error and allow the process to continue as normal.

Eric





reply via email to

[Prev in Thread] Current Thread [Next in Thread]