New Spell Feature Oddities - 7.0aa build 83

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

New Spell Feature Oddities - 7.0aa build 83

Bill McCarthy
Hello Vim Developers,

Using the new `zg` command appears to do nothing the
first time I use it.  However, the two files:

    vim\vimfiles\spell\en.latin1.add
    vim\vimfiles\spell\en.latin1.add.spl

are created and if I close and reopen the same file, the
word marked as good no longer shows up as an error - so it
actually worked.  Now when I mark other words as good, I see
the affect immediately - it is just the first time that
fails to show the marked word as now good.

After adding 18 words, I note that the 156 byte .add
file has a 579 byte .spl file.

I copied the .add file then deleted both .add and .spl
files.  I then edited the copied file and marked all the
words as good - like above, each word continued to show as a
spell error.  However, closing and reopening the file showed
them all as good as expected.  The new .spl file was still
579 bytes.

I next deleted just the .spl file, then from Gvim recreated
it with:

    :mksp en.latin1.add

The file created was also 579 bytes.  However when I opened
the copied file and activated spell checking, I received the
following message:

Error detected while processing C:\vim\vimfiles\spell\en.latin1.add.spl:
E763: Word characters differ between spell files
E759: Format error in spell file

Also, all of the words were marked as wrong.

I then tried:

    :mksp! -ascii en.latin1.add

This produced a 323 byte file.  Editing the saved file and
turning on spell check now worked - all words were good.

Note that none of my words contain non-ascii characters.

What is wrong here?

--
Best regards,
Bill


Reply | Threaded
Open this post in threaded view
|

Re: New Spell Feature Oddities - 7.0aa build 83

Bram Moolenaar

Bill McCarthy wrote:

> Using the new `zg` command appears to do nothing the
> first time I use it.  However, the two files:
>
>     vim\vimfiles\spell\en.latin1.add
>     vim\vimfiles\spell\en.latin1.add.spl
>
> are created and if I close and reopen the same file, the
> word marked as good no longer shows up as an error - so it
> actually worked.  Now when I mark other words as good, I see
> the affect immediately - it is just the first time that
> fails to show the marked word as now good.

I see the problem.  The new .add.spl file is not in the list of spell
files the first time.  Setting 'encoding' again also helps (all spell
files are reloaded then).  I'll find a solution.

> I next deleted just the .spl file, then from Gvim recreated
> it with:
>
>     :mksp en.latin1.add
>
> The file created was also 579 bytes.  However when I opened
> the copied file and activated spell checking, I received the
> following message:
>
> Error detected while processing C:\vim\vimfiles\spell\en.latin1.add.spl:
> E763: Word characters differ between spell files
> E759: Format error in spell file

Since Vim allows mixing languages, and detecting word boundaries
requires knowing what characters are word characters, and a library
function like isalpha() depends on the current locale, and 'encoding'
may differ from the current locale, the list of word characters is
stored in the .spl file.  Unfortunately, this means that when you
generate a .spl file using a different locale, the word characters
differ and Vim gets confused when loading two .spl files with a
different word table.  That's where the error message comes from.

Perhaps a solution is to ignore the word table in a .add.spl file, thus
assuming that the word characters as defined in the main spell file
apply.  Or simpler: don't store the word table in the .add.spl file.
Results in a shorter .spl file too.

I'm currently working on suggestions, making good progress...

--
hundred-and-one symptoms of being an internet addict:
79. All of your most erotic dreams have a scrollbar at the right side.

 /// Bram Moolenaar -- [hidden email] -- http://www.Moolenaar.net   \\\
///        Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\              Project leader for A-A-P -- http://www.A-A-P.org        ///
 \\\     Buy LOTR 3 and help AIDS victims -- http://ICCF.nl/lotr.html   ///
Reply | Threaded
Open this post in threaded view
|

Re: New Spell Feature Oddities - 7.0aa build 83

Bill McCarthy
On Sun 12-Jun-05 5:26am -0500, Bram Moolenaar wrote:

> Since Vim allows mixing languages, and detecting word boundaries
> requires knowing what characters are word characters, and a library
> function like isalpha() depends on the current locale, and 'encoding'
> may differ from the current locale, the list of word characters is
> stored in the .spl file.  Unfortunately, this means that when you
> generate a .spl file using a different locale, the word characters
> differ and Vim gets confused when loading two .spl files with a
> different word table.  That's where the error message comes from.
>
> Perhaps a solution is to ignore the word table in a .add.spl file, thus
> assuming that the word characters as defined in the main spell file
> apply.  Or simpler: don't store the word table in the .add.spl file.
> Results in a shorter .spl file too.

I understand that the locale in the distributed .spl
files may be different from that generated using `zg`.
There are three distributed .spl file - vim picks one
when I activate spelling - I use:

    nmap <Leader>sc :setlocal spell spelllang=en_us<CR>

Also vim appears to set my locale on its own.  Looking
at the various output from :language [|mes|cty|tim],
they each product:

    English_United States.1252

I can find no reference to this in my hive (Win XP Pro)
- I searched for "English_United" - or my environment.

I do like a human readable .add file which can be
sorted or otherwise edited - as long as I can regen the
associated .spl file.  As I noted,

    :mksp! -ascii {file}

appears to do just that - too bad we need to add that
odd `-ascii`, since not using it generates errors.
Perhaps the -ascii could be the default and a new
-my_locale_is_the_distribution_locale flag could be
added :-)

BTW, what command is executed by Vim when `zg` is
invoked?  We now know, I think, that it is not :mksp!.

> I'm currently working on suggestions, making good progress...

That is a big step that I am looking forward to trying
out.  A smaller, but also very useful addition, is to
add the "temporary good words" as found in Chip
Campbell's work.

--
Best regards,
Bill


Reply | Threaded
Open this post in threaded view
|

Re: New Spell Feature Oddities - 7.0aa build 83

Bram Moolenaar

Bill McCarthy wrote:

> I understand that the locale in the distributed .spl
> files may be different from that generated using `zg`.
> There are three distributed .spl file - vim picks one
> when I activate spelling - I use:
>
>     nmap <Leader>sc :setlocal spell spelllang=en_us<CR>
>
> Also vim appears to set my locale on its own.  Looking
> at the various output from :language [|mes|cty|tim],
> they each product:
>
>     English_United States.1252

That must be the default for your system.  The name is not inside the
Vim code.

> I can find no reference to this in my hive (Win XP Pro)
> - I searched for "English_United" - or my environment.
>
> I do like a human readable .add file which can be
> sorted or otherwise edited - as long as I can regen the
> associated .spl file.

That's the idea.  It's often much easier to edit the file than to use
"zg" or ":spellgood" to add words.  And it allows you to remove
accidentally added bad words.

> As I noted,
>
>     :mksp! -ascii {file}
>
> appears to do just that - too bad we need to add that
> odd `-ascii`, since not using it generates errors.
> Perhaps the -ascii could be the default and a new
> -my_locale_is_the_distribution_locale flag could be
> added :-)

I already made it so that the word table isn't stored in the .add.spl
file, that should fix it.  I'm not releasing a new snapshot yet, the
spell suggestion code is halfway messing about.

> BTW, what command is executed by Vim when `zg` is
> invoked?  We now know, I think, that it is not :mksp!.

It's almost identical to ":mkspell! <spellfile>".  The messages are
avoided.

> > I'm currently working on suggestions, making good progress...
>
> That is a big step that I am looking forward to trying
> out.  A smaller, but also very useful addition, is to
> add the "temporary good words" as found in Chip
> Campbell's work.

I don't know how this would work (I still need to have a better look at
Chip's plugin).  Ignore words without storing them in a file?  If you do
want to store them somewhere else you could set 'spellfile' to something
else for a moment.

--
Ed's Radiator Shop: The Best Place in Town to Take a Leak.

 /// Bram Moolenaar -- [hidden email] -- http://www.Moolenaar.net   \\\
///        Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\              Project leader for A-A-P -- http://www.A-A-P.org        ///
 \\\     Buy LOTR 3 and help AIDS victims -- http://ICCF.nl/lotr.html   ///
Reply | Threaded
Open this post in threaded view
|

Re: New Spell Feature Oddities - 7.0aa build 83

Bill McCarthy
On Sun 12-Jun-05 4:44pm -0500, Bram Moolenaar wrote:

> Bill McCarthy wrote:

>> A smaller, but also very useful addition, is to add
>> the "temporary good words" as found in Chip
>> Campbell's work.

> I don't know how this would work (I still need to have a better look at
> Chip's plugin).  Ignore words without storing them in a file?  If you do
> want to store them somewhere else you could set 'spellfile' to something
> else for a moment.

I have experimented with 'spf' by setting in to, in
turn, \vim\vimfiles\spell\temp.add and
\vim\vimfiles\spell\en.latin1.temp.add.  `zg` does
place words there, but vim only appears to recognize
the distribution and
\vim\vimfiles\spell\en.latin1.add.spl.  The new temp
file is ignored even when I point to it via 'spf'
before invoking spell checking.

--
Best regards,
Bill


Reply | Threaded
Open this post in threaded view
|

Re: New Spell Feature Oddities - 7.0aa build 83

Bram Moolenaar

Bill McCarthy wrote:

> >> A smaller, but also very useful addition, is to add
> >> the "temporary good words" as found in Chip
> >> Campbell's work.
>
> > I don't know how this would work (I still need to have a better look at
> > Chip's plugin).  Ignore words without storing them in a file?  If you do
> > want to store them somewhere else you could set 'spellfile' to something
> > else for a moment.
>
> I have experimented with 'spf' by setting in to, in
> turn, \vim\vimfiles\spell\temp.add and
> \vim\vimfiles\spell\en.latin1.temp.add.  `zg` does
> place words there, but vim only appears to recognize
> the distribution and
> \vim\vimfiles\spell\en.latin1.add.spl.  The new temp
> file is ignored even when I point to it via 'spf'
> before invoking spell checking.

Currently the 'spellfile' needs to be in 'runtimepath', otherwise it's
not found.  I suppose you would expect it to be loaded anyway.  That
requires an extra check...

--
hundred-and-one symptoms of being an internet addict:
87. Everyone you know asks why your phone line is always busy ...and
    you tell them to send an e-mail.

 /// Bram Moolenaar -- [hidden email] -- http://www.Moolenaar.net   \\\
///        Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\              Project leader for A-A-P -- http://www.A-A-P.org        ///
 \\\     Buy LOTR 3 and help AIDS victims -- http://ICCF.nl/lotr.html   ///