all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Third <alan@idiocy.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 19229@debbugs.gnu.org
Subject: bug#19229: ispell on Windows
Date: Fri, 22 May 2015 19:57:17 +0100	[thread overview]
Message-ID: <CABGBtwkBSZ+hZVB8vqx=ghr5o882jsK1=zZrtpGAasQEc6sHfg@mail.gmail.com> (raw)
In-Reply-To: <83fv6p5cix.fsf@gnu.org>

On 22 May 2015 at 07:53, Eli Zaretskii <eliz@gnu.org> wrote:
>> Date: Thu, 21 May 2015 21:19:19 +0100
>> From: Alan Third <alan@idiocy.org>
>> Cc: 19229@debbugs.gnu.org
>>
>> On 21 May 2015 at 17:23, Eli Zaretskii <eliz@gnu.org> wrote:
>> >> Date: Thu, 21 May 2015 09:16:00 +0100
>> >> From: Alan Third <alan@idiocy.org>
>> >> Cc: 19229@debbugs.gnu.org
>> >>
>> >> This works in windows! Once this is done I can then use
>> >> ispell-change-dictionary to change the dictionary to anything I want.
>> >> Presumably, then, the problem I'm seeing is that ispell+hunspell falls
>> >> over if the dictionary initially set by emacs doesn't exist.
>>
>> OK, I was completely wrong here.
>
> In what way?

Well, it seems the above is right on Windows but wrong on OS X. On
Windows it tries to set the dictionary to "ENG", because that's what
emacs puts in LANG, but on OS X it never gets as far as setting a
dictionary because there's nothing at all in LANG and emacs doesn't
automatically set it.

What confuses this on OS X is that when you run hunspell from the
command line LANG *IS* set and so it works, but from within emacs (run
from the GUI) LANG *ISN'T* set so it fails.

>> > First, you can customize the variable ispell-dictionary to name the
>> > dictionary (without the .aff or .dic extensions, just the stem of the
>> > basename, as in "en_GB").  You can set this in your ~/.emacs.  This
>> > will cause ispell.el to invoke Hunspell with the appropriate -d
>> > command-line option.
>>
>> This doesn't work. I've done some digging in ispell.el and I think I
>> know what's going on.
>>
>> The function ispell-find-hunspell-dictionaries parses the output of
>> `hunspell -D` looking for *hunspell's* default dictionary. If you
>> don't have any of the variables you mentioned set then hunspell
>> doesn't give a default.
>
> What does your Hunspell say when you invoke it with -D?  Mine says
> this:
>
<snip>
>
> Note that the default dictionary it loaded, as announced near the end.

On Windows from within emacs:

SEARCH PATH:
.;;C:\Hunspell\;c:/users/thirda\.openoffice.org\3\user\wordbook;c:\Users\thirda\local\bin\..\share\hunspell;C:\Program
files\OpenOffice.org 2.4\share\dict\ooo\;C:\Program
files\OpenOffice.org 2.3\share\dict\ooo\;C:\Program
files\OpenOffice.org 2.2\share\dict\ooo\;C:\Program
files\OpenOffice.org 2.1\share\dict\ooo\;C:\Program
files\OpenOffice.org 2.0\share\dict\ooo\
AVAILABLE DICTIONARIES (path is not mandatory for -d option):
c:\Users\thirda\local\bin\..\share\hunspell\default
c:\Users\thirda\local\bin\..\share\hunspell\en_GB
c:\Users\thirda\local\bin\..\share\hunspell\en_US
Can't open affix or dictionary files for dictionary named "ENG".

Creating an "ENG" dictionary fixes this.

On OS X from within emacs:

SEARCH PATH:
.::/usr/share/hunspell:/usr/share/myspell:/usr/share/myspell/dicts:/Library/Spelling:/Users/alan/.openoffice.org/3/user/wordbook::/Users/alan/.openoffice.org2/user/wordbook::/Users/alan/.openoffice.org2.0/user/wordbook::/Users/alan/Library/Spelling:/opt/openoffice.org/basis3.0/share/dict/ooo:/usr/lib/openoffice.org/basis3.0/share/dict/ooo:/opt/openoffice.org2.4/share/dict/ooo:/usr/lib/openoffice.org2.4/share/dict/ooo:/opt/openoffice.org2.3/share/dict/ooo:/usr/lib/openoffice.org2.3/share/dict/ooo:/opt/openoffice.org2.2/share/dict/ooo:/usr/lib/openoffice.org2.2/share/dict/ooo:/opt/openoffice.org2.1/share/dict/ooo:/usr/lib/openoffice.org2.1/share/dict/ooo:/opt/openoffice.org2.0/share/dict/ooo:/usr/lib/openoffice.org2.0/share/dict/ooo
AVAILABLE DICTIONARIES (path is not mandatory for -d option):
/Library/Spelling/en_GB
Can't open affix or dictionary files for dictionary named "default".

Creating an ENG dictionary doesn't help here because:

(getenv "LANG")

returns nil.

> Once again, I ask where you got your Hunspell binary.  In the binary
> distribution here:
>
>   http://sourceforge.net/projects/ezwinports/files/hunspell-1.3.2-3-w32-bin.zip/download

That's the one I'm using on Windows.

On OS X I'm using the one from "homebrew", which seems to be up to
date.

And I've just worked out where I need to put a default dictionary to
get it to work: /usr/share/myspell.

>> Specifically, it looks for a line that ends ".aff" then uses that line
>> in an argument for ispell-parse-hunspell-affix-file, which fails if
>> it's nil, which in my case it is. Because that function errors,
>> ispell-find-hunspell-dictionaries stops processing and therefore never
>> builds ispell-hunspell-dictionary-alist, which seems to be a pretty
>> vital variable.
>>
>> While that doesn't seem like very good behaviour to me, I don't know
>> if you'd classify it as a bug.
>
> I see no bug here.  It works for me.  I think your Hunspell
> installation is misconfigured, that's all.

That's why I wasn't sure if you'd think it was a bug. :)

I tried wrapping the call to ispell-parse-hunspell-affix-file in an if
that checks whether hunspell-default-dict is set and the error
messages went away. Then I could use ispell-dictionary or
ispell-change-dictionary to set the one I wanted, just like with
aspell.

I assume that ispell-parse-hunspell-affix-file is called whenever you
change dictionary, so this shouldn't break anything.

Whatever, I'll try writing up what I've learnt on emacswiki.org since
all the information on the internet seems to be somewhat out of date
and unhelpful.

Thanks!
-- 
Alan Third





  reply	other threads:[~2015-05-22 18:57 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-30 18:25 bug#19229: ispell-phaf: No matching entry for Alexander Shukaev
2014-11-30 19:50 ` bug#19229: A workaround for hunspell Chris Zheng
2014-12-01 16:26   ` Eli Zaretskii
2014-11-30 21:15 ` bug#19229: ispell-phaf: No matching entry for Eli Zaretskii
2014-11-30 21:55   ` Alexander Shukaev
2014-12-01 16:24     ` Eli Zaretskii
2014-12-01 17:15       ` Alexander Shukaev
2015-05-20 18:53 ` bug#19229: ispell on Windows Alan Third
2015-05-20 19:21   ` Eli Zaretskii
2015-05-20 20:34     ` Alan Third
2015-05-21  2:41       ` Eli Zaretskii
2015-05-21  8:16         ` Alan Third
2015-05-21 16:23           ` Eli Zaretskii
2015-05-21 20:19             ` Alan Third
2015-05-22  6:53               ` Eli Zaretskii
2015-05-22 18:57                 ` Alan Third [this message]
2015-05-22 19:22                   ` Eli Zaretskii
2015-05-22 19:55                     ` Alan Third
2015-05-22 20:08                       ` Eli Zaretskii
2015-05-22 21:46                       ` Jan D.
2020-09-07 21:55                       ` Lars Ingebrigtsen
2020-09-07 22:08                         ` Alan Third
2020-09-08 10:12                           ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CABGBtwkBSZ+hZVB8vqx=ghr5o882jsK1=zZrtpGAasQEc6sHfg@mail.gmail.com' \
    --to=alan@idiocy.org \
    --cc=19229@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.