On Sa, 07 Sep 2013, Gary Johnson wrote:
> On 2013-08-12, Gary Johnson wrote:
> > On 2013-08-12, Christian Brabandt wrote:
>
> > > Oh well, here is an updated version attached. Yes, it is really
> > > attached...
> >
> > I'm glad to have the updated patch. Thank you. It is working fine
> > so far. I'll let you know if that changes.
>
> I just noticed an odd behavior of the spell feature with your patch
> included. I did not have 'spell' enabled but checked the spelling
> of a word with z=. The word was not in the list, so I found the
> correct spelling on the web, changed the word in my text, and
> attempted to add it to my spelling list with zg. Two messages
> appeared:
>
> E756: Spell checking is not enabled
> Word added to ~/.vim/spell/en.utf-8.add
>
> Since the word was added successfully, it seems that the error
> message should not have appeared.
That is actually a strange behaviour of normal Vim and has nothing to do
with my patch.
Bram,
problem is, nv_zet calls spell_move_to() function, which errors out, if
spell checking is not enabled. But if spell checking is not enabled, Vim
uses find_ident_under_cursor() to get the identifier under the cursor and
adds this nevertheless to the spellfile.
I think, this can cause vim to add/remove different words to the
spellfile, depending on the 'spell' setting, but I am not sure, how to
test (the second patch at least makes Vim mention, which word has been
added/removed).
Here is a patch, that prevents the spurious E756 error in the case of 'zg/zb'
diff --git a/src/normal.c b/src/normal.c
--- a/src/normal.c
+++ b/src/normal.c
@@ -5247,7 +5247,9 @@
pos_T pos = curwin->w_cursor;
/* Find bad word under the cursor. */
+ emsg_off++; /* Avoid E576 error */
len = spell_move_to(curwin, FORWARD, TRUE, TRUE, NULL);
+ emsg_off--;
if (len != 0 && curwin->w_cursor.col <= pos.col)
ptr = ml_get_pos(&curwin->w_cursor);
curwin->w_cursor = pos;
And this patch, explicitly tells the user, what word has been
removed/added to the spellfile:
diff --git a/src/spell.c b/src/spell.c
--- a/src/spell.c
+++ b/src/spell.c
@@ -9479,7 +9479,7 @@
if (undo)
{
home_replace(NULL, fname, NameBuff, MAXPATHL, TRUE);
- smsg((char_u *)_("Word removed from %s"), NameBuff);
+ smsg((char_u *)_("Word '%s' removed from %s"),
word, NameBuff);
}
}
fseek(fd, fpos_next, SEEK_SET);
@@ -9525,7 +9525,7 @@
fclose(fd);
home_replace(NULL, fname, NameBuff, MAXPATHL, TRUE);
- smsg((char_u *)_("Word added to %s"), NameBuff);
+ smsg((char_u *)_("Word '%s' added to %s"), word, NameBuff);
}
}
regards,
Christian
--
Man muß alt geworden sein, also gelebt haben, um zu erkennen, wie kurz
das Leben ist.
-- Arthur Schopenhauer (Aphorismen zur Lebensweisheit)
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.