Loading ...
Sorry, an error occurred while loading the content.
 

Suggestion: allow 'z=' when spell-checking isn't on

Expand Messages
  • James Cole
    Hi, I don t usually enable spell-checking when I m writing, as I find the underlines under misspellings a bit distracting. But sometimes I think or know that
    Message 1 of 18 , Jul 31, 2012
      Hi,

      I don't usually enable spell-checking when I'm writing, as I find the underlines under misspellings a bit distracting. But sometimes I think or know that a word is misspelt, and I'd like to be able to use z= to bring up a list of spelling suggestions.

      But doing this when spell-checking is not on brings up an error "E756: Spell checking is not enabled". My suggestion is to allow the user to see spelling suggestions in such situations. I know it'd be possible to write a map to do this, but it seems like it'd be a sensible default behavior for z=

      For someone like me this would save the effort of having to first enable spell-checking, and then turning it off again immediately afterwards (to avoid the red underlines), and as far as I can see there would be no harm to allow this.

      Regards,
      James.

      --
      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
    • Ben Fritz
      ... How about: nnoremap z= : set spell z= And probably another mapping to turn off spell check if you want it. Alternatively, you could just change the
      Message 2 of 18 , Jul 31, 2012
        On Tuesday, July 31, 2012 3:52:06 AM UTC-5, James Cole wrote:
        > Hi,
        >
        > I don't usually enable spell-checking when I'm writing, as I find the underlines under misspellings a bit distracting. But sometimes I think or know that a word is misspelt, and I'd like to be able to use z= to bring up a list of spelling suggestions.
        >
        > But doing this when spell-checking is not on brings up an error "E756: Spell checking is not enabled". My suggestion is to allow the user to see spelling suggestions in such situations. I know it'd be possible to write a map to do this, but it seems like it'd be a sensible default behavior for z=
        >
        > For someone like me this would save the effort of having to first enable spell-checking, and then turning it off again immediately afterwards (to avoid the red underlines), and as far as I can see there would be no harm to allow this.
        >
        > Regards,
        > James.

        How about:

        nnoremap z= :<C-U>set spell<CR>z=

        And probably another mapping to turn off spell check if you want it.

        Alternatively, you could just change the highlight to be less distracting, using :hi rules on SpellBad, SpellCap, SpellRare, and SpellLocal.

        --
        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
      • Ingo Karkat
        ... Have you read his actual email? James explicitly referred to the shortcomings of such a mapping. I second James request, especially because I have written
        Message 3 of 18 , Jul 31, 2012
          On 31-Jul-2012 18:56:21 +0200, Ben Fritz wrote:

          > On Tuesday, July 31, 2012 3:52:06 AM UTC-5, James Cole wrote:
          >> [...] I know it'd be possible to write a map to do this, but it seems
          >> like it'd be a sensible default behavior for z=
          >>
          >> [4 lines deleted]
          >
          > How about:
          >
          > nnoremap z= :<C-U>set spell<CR>z=
          >
          > And probably another mapping to turn off spell check if you want it.
          >
          > Alternatively, you could just change the highlight to be less
          > distracting, using :hi rules on SpellBad, SpellCap, SpellRare, and
          > SpellLocal.

          Have you read his actual email? James explicitly referred to the shortcomings of
          such a mapping. I second James' request, especially because I have written such
          a mapping for myself, and it isn't trivial (have to handle empty 'spelllang' and
          other settings that prevent spell checking, turning off 'spell' again after the
          user interaction requires an autocmd, ...)

          -- regards, ingo

          --
          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
        • Ben Fritz
          ... I see I know it d be possible to write a map to do this, but it seems like it d be a sensible default behavior for z= but don t see a discussion of the
          Message 4 of 18 , Jul 31, 2012
            On Tuesday, July 31, 2012 1:04:21 PM UTC-5, Ingo Karkat wrote:
            > On 31-Jul-2012 18:56:21 +0200, Ben Fritz wrote:
            >
            >
            >
            > > On Tuesday, July 31, 2012 3:52:06 AM UTC-5, James Cole wrote:
            >
            > >> [...] I know it'd be possible to write a map to do this, but it seems
            >
            > >> like it'd be a sensible default behavior for z=
            >
            > >>
            >
            > >> [4 lines deleted]
            >
            > >
            >
            > > How about:
            >
            > >
            >
            > > nnoremap z= :<C-U>set spell<CR>z=
            >
            > >
            >
            > > And probably another mapping to turn off spell check if you want it.
            >
            > >
            >
            > > Alternatively, you could just change the highlight to be less
            >
            > > distracting, using :hi rules on SpellBad, SpellCap, SpellRare, and
            >
            > > SpellLocal.
            >
            >
            >
            > Have you read his actual email? James explicitly referred to the shortcomings of
            >
            > such a mapping. I second James' request, especially because I have written such
            >
            > a mapping for myself, and it isn't trivial (have to handle empty 'spelllang' and
            >
            > other settings that prevent spell checking, turning off 'spell' again after the
            >
            > user interaction requires an autocmd, ...)
            >
            >
            >
            > -- regards, ingo

            I see "I know it'd be possible to write a map to do this, but it seems like it'd be a sensible default behavior for z=" but don't see a discussion of the shortcomings.

            However, I can agree that it would be a useful feature to not require such a mapping.

            --
            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
          • Ingo Karkat
            ... I think the key part that you missed is automatically turning off the spell checking / highlighting after z=. Your proposed mapping doesn t even attempt
            Message 5 of 18 , Jul 31, 2012
              On 31-Jul-2012 21:31:24 +0200, Ben Fritz wrote:

              > On Tuesday, July 31, 2012 1:04:21 PM UTC-5, Ingo Karkat wrote:
              >> On 31-Jul-2012 18:56:21 +0200, Ben Fritz wrote:
              >>
              >>
              >>
              >>> On Tuesday, July 31, 2012 3:52:06 AM UTC-5, James Cole wrote:
              >>
              >>>> [...] I know it'd be possible to write a map to do this, but it seems
              >>
              >>>> like it'd be a sensible default behavior for z=
              >>
              >>>>
              >>
              >>>> [4 lines deleted]
              >>
              >>>
              >>
              >>> How about:
              >>
              >>>
              >>
              >>> nnoremap z= :<C-U>set spell<CR>z=
              >>
              >>>
              >>
              >>> And probably another mapping to turn off spell check if you want it.
              >>
              >>>
              >>
              >>> Alternatively, you could just change the highlight to be less
              >>
              >>> distracting, using :hi rules on SpellBad, SpellCap, SpellRare, and
              >>
              >>> SpellLocal.
              >>
              >>
              >>
              >> Have you read his actual email? James explicitly referred to the shortcomings of
              >>
              >> such a mapping. I second James' request, especially because I have written such
              >>
              >> a mapping for myself, and it isn't trivial (have to handle empty 'spelllang' and
              >>
              >> other settings that prevent spell checking, turning off 'spell' again after the
              >>
              >> user interaction requires an autocmd, ...)
              >>
              >>
              >>
              >> -- regards, ingo
              >
              > I see "I know it'd be possible to write a map to do this, but it seems
              > like it'd be a sensible default behavior for z=" but don't see a
              > discussion of the shortcomings.

              I think the key part that you missed is automatically turning off the spell
              checking / highlighting after z=. Your proposed mapping doesn't even attempt
              that. Having to invoke a second mapping to turn this off is very cumbersome, and
              not what James had in mind.

              > However, I can agree that it would be a useful feature to not require
              > such a mapping.

              Right. Especially because it's difficult to write a mapping around something
              that requires user interaction, like the query of the spell correction candidate
              in z=.

              -- regards, ingo

              --
              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
            • Christian Brabandt
              Hi Ingo! ... Does this patch work for you? diff --git a/src/spell.c b/src/spell.c ... +++ b/src/spell.c @@ -10155,9 +10155,24 @@ int selected =
              Message 6 of 18 , Aug 5, 2012
                Hi Ingo!

                On Di, 31 Jul 2012, Ingo Karkat wrote:

                > On 31-Jul-2012 21:31:24 +0200, Ben Fritz wrote:
                >
                > > On Tuesday, July 31, 2012 1:04:21 PM UTC-5, Ingo Karkat wrote:
                > >> On 31-Jul-2012 18:56:21 +0200, Ben Fritz wrote:
                > >>
                > >>
                > >>
                > >>> On Tuesday, July 31, 2012 3:52:06 AM UTC-5, James Cole wrote:
                > >>
                > >>>> [...] I know it'd be possible to write a map to do this, but it seems
                > >>
                > >>>> like it'd be a sensible default behavior for z=
                > >>
                > >>>>
                > >>
                > >>>> [4 lines deleted]
                > >>
                > >>>
                > >>
                > >>> How about:
                > >>
                > >>>
                > >>
                > >>> nnoremap z= :<C-U>set spell<CR>z=
                > >>
                > >>>
                > >>
                > >>> And probably another mapping to turn off spell check if you want it.
                > >>
                > >>>
                > >>
                > >>> Alternatively, you could just change the highlight to be less
                > >>
                > >>> distracting, using :hi rules on SpellBad, SpellCap, SpellRare, and
                > >>
                > >>> SpellLocal.
                > >>
                > >>
                > >>
                > >> Have you read his actual email? James explicitly referred to the shortcomings of
                > >>
                > >> such a mapping. I second James' request, especially because I have written such
                > >>
                > >> a mapping for myself, and it isn't trivial (have to handle empty 'spelllang' and
                > >>
                > >> other settings that prevent spell checking, turning off 'spell' again after the
                > >>
                > >> user interaction requires an autocmd, ...)
                > >>
                > >>
                > >>
                > >> -- regards, ingo
                > >
                > > I see "I know it'd be possible to write a map to do this, but it seems
                > > like it'd be a sensible default behavior for z=" but don't see a
                > > discussion of the shortcomings.
                >
                > I think the key part that you missed is automatically turning off the spell
                > checking / highlighting after z=. Your proposed mapping doesn't even attempt
                > that. Having to invoke a second mapping to turn this off is very cumbersome, and
                > not what James had in mind.
                >
                > > However, I can agree that it would be a useful feature to not require
                > > such a mapping.
                >
                > Right. Especially because it's difficult to write a mapping around something
                > that requires user interaction, like the query of the spell correction candidate
                > in z=.


                Does this patch work for you?

                diff --git a/src/spell.c b/src/spell.c
                --- a/src/spell.c
                +++ b/src/spell.c
                @@ -10155,9 +10155,24 @@
                int selected = count;
                int badlen = 0;
                int msg_scroll_save = msg_scroll;
                -
                - if (no_spell_checking(curwin))
                + int wo_spell_save;
                +
                +/* if (no_spell_checking(curwin))
                + return; */
                + wo_spell_save = curwin->w_p_spell;
                +
                + if (!curwin->w_p_spell)
                + {
                + did_set_spelllang(curwin);
                + curwin->w_p_spell = TRUE;
                + }
                +
                + if (*curwin->w_s->b_p_spl == NUL)
                + {
                + EMSG(_("E756: Spell checking is not possible"));
                return;
                + }
                +

                #ifdef FEAT_VISUAL
                if (VIsual_active)
                @@ -10377,6 +10392,7 @@
                spell_find_cleanup(&sug);
                skip:
                vim_free(line);
                + curwin->w_p_spell = wo_spell_save;
                }

                /*



                Mit freundlichen Grüßen
                Christian
                --
                Die meisten Menschen sind unzufrieden, weil die wenigsten wissen, daß
                der Abstand zwischen Eins und Nichts größer ist als der zwischen Eins
                und Tausend.
                -- Ludwig Börne (Der Narr im Weißen Schwan)

                --
                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
              • Gary Johnson
                ... So far, so good. Thanks! I did have to replace some sequences of spaces in the patch with real tabs for the patch to apply. Regards, Gary -- You received
                Message 7 of 18 , Aug 5, 2012
                  On 2012-08-05, Christian Brabandt wrote:
                  > Hi Ingo!

                  > Does this patch work for you?

                  So far, so good. Thanks! I did have to replace some sequences of
                  spaces in the patch with real tabs for the patch to apply.

                  Regards,
                  Gary

                  --
                  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
                • Bram Moolenaar
                  ... I wonder if there are any side effects of doing it this way. E.g., if someone accidentally does z=, is any redrawing different, syntax HL, etc.? I
                  Message 8 of 18 , Aug 6, 2012
                    Christian Brabandt wrote:

                    > On Di, 31 Jul 2012, Ingo Karkat wrote:
                    >
                    > > On 31-Jul-2012 21:31:24 +0200, Ben Fritz wrote:
                    > > > On Tuesday, July 31, 2012 1:04:21 PM UTC-5, Ingo Karkat wrote:
                    > > >> On 31-Jul-2012 18:56:21 +0200, Ben Fritz wrote:
                    > > >>
                    > > >>> On Tuesday, July 31, 2012 3:52:06 AM UTC-5, James Cole wrote:
                    > > >>>> [...] I know it'd be possible to write a map to do this, but it seems
                    > > >>>> like it'd be a sensible default behavior for z=
                    > > >>>>
                    > > >>>> [4 lines deleted]
                    > > >>>
                    > > >>> How about:
                    > > >>>
                    > > >>> nnoremap z= :<C-U>set spell<CR>z=
                    > > >>>
                    > > >>> And probably another mapping to turn off spell check if you want it.
                    > > >>>
                    > > >>> Alternatively, you could just change the highlight to be less
                    > > >>> distracting, using :hi rules on SpellBad, SpellCap, SpellRare, and
                    > > >>> SpellLocal.
                    > > >>
                    > > >> Have you read his actual email? James explicitly referred to the
                    > > >> shortcomings of such a mapping. I second James' request, especially
                    > > >> because I have written such a mapping for myself, and it isn't
                    > > >> trivial (have to handle empty 'spelllang' and other settings that
                    > > >> prevent spell checking, turning off 'spell' again after the user
                    > > >> interaction requires an autocmd, ...)
                    > > >>
                    > > >> -- regards, ingo
                    > > >
                    > > > I see "I know it'd be possible to write a map to do this, but it seems
                    > > > like it'd be a sensible default behavior for z=" but don't see a
                    > > > discussion of the shortcomings.
                    > >
                    > > I think the key part that you missed is automatically turning off the
                    > > spell checking / highlighting after z=. Your proposed mapping doesn't
                    > > even attempt that. Having to invoke a second mapping to turn this off
                    > > is very cumbersome, and not what James had in mind.
                    > >
                    > > > However, I can agree that it would be a useful feature to not
                    > > > require such a mapping.
                    > >
                    > > Right. Especially because it's difficult to write a mapping around
                    > > something that requires user interaction, like the query of the spell
                    > > correction candidate in z=.
                    >
                    >
                    > Does this patch work for you?

                    I wonder if there are any side effects of doing it this way. E.g., if
                    someone accidentally does z=, is any redrawing different, syntax HL,
                    etc.? I suppose it's inefficient, but that would be less important.


                    --
                    hundred-and-one symptoms of being an internet addict:
                    217. Your sex life has drastically improved...so what if it's only cyber-sex!

                    /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
                    /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
                    \\\ an exciting new programming language -- http://www.Zimbu.org ///
                    \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

                    --
                    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
                  • Ingo Karkat
                    ... Hello Christian, Sorry for checking this so late, but the patch indeed works for me. I see that it s already in the todo list with a remark to also apply
                    Message 9 of 18 , Sep 4 2:34 AM
                      On 05-Aug-2012 20:57:24 +0200, Christian Brabandt wrote:

                      > Hi Ingo!
                      >
                      > On Di, 31 Jul 2012, Ingo Karkat wrote:
                      >
                      >> On 31-Jul-2012 21:31:24 +0200, Ben Fritz wrote:
                      >>
                      >>> On Tuesday, July 31, 2012 1:04:21 PM UTC-5, Ingo Karkat wrote:
                      >>>> On 31-Jul-2012 18:56:21 +0200, Ben Fritz wrote:
                      >>>>
                      >>>>
                      >>>>
                      >>>>> On Tuesday, July 31, 2012 3:52:06 AM UTC-5, James Cole wrote:
                      >>>>
                      >>>>>> [...] I know it'd be possible to write a map to do this, but it seems
                      >>>>
                      >>>>>> like it'd be a sensible default behavior for z=
                      >>>>
                      >>>>>>
                      >>>>
                      >>>>>> [4 lines deleted]
                      >>>>
                      >>>>>
                      >>>>
                      >>>>> How about:
                      >>>>
                      >>>>>
                      >>>>
                      >>>>> nnoremap z= :<C-U>set spell<CR>z=
                      >>>>
                      >>>>>
                      >>>>
                      >>>>> And probably another mapping to turn off spell check if you want it.
                      >>>>
                      >>>>>
                      >>>>
                      >>>>> Alternatively, you could just change the highlight to be less
                      >>>>
                      >>>>> distracting, using :hi rules on SpellBad, SpellCap, SpellRare, and
                      >>>>
                      >>>>> SpellLocal.
                      >>>>
                      >>>>
                      >>>>
                      >>>> Have you read his actual email? James explicitly referred to the shortcomings of
                      >>>>
                      >>>> such a mapping. I second James' request, especially because I have written such
                      >>>>
                      >>>> a mapping for myself, and it isn't trivial (have to handle empty 'spelllang' and
                      >>>>
                      >>>> other settings that prevent spell checking, turning off 'spell' again after the
                      >>>>
                      >>>> user interaction requires an autocmd, ...)
                      >>>>
                      >>>>
                      >>>>
                      >>>> -- regards, ingo
                      >>>
                      >>> I see "I know it'd be possible to write a map to do this, but it seems
                      >>> like it'd be a sensible default behavior for z=" but don't see a
                      >>> discussion of the shortcomings.
                      >>
                      >> I think the key part that you missed is automatically turning off the spell
                      >> checking / highlighting after z=. Your proposed mapping doesn't even attempt
                      >> that. Having to invoke a second mapping to turn this off is very cumbersome, and
                      >> not what James had in mind.
                      >>
                      >>> However, I can agree that it would be a useful feature to not require
                      >>> such a mapping.
                      >>
                      >> Right. Especially because it's difficult to write a mapping around something
                      >> that requires user interaction, like the query of the spell correction candidate
                      >> in z=.
                      >
                      >
                      > Does this patch work for you?
                      >
                      > diff --git a/src/spell.c b/src/spell.c
                      > --- a/src/spell.c
                      > +++ b/src/spell.c
                      > @@ -10155,9 +10155,24 @@
                      > int selected = count;
                      > int badlen = 0;
                      > int msg_scroll_save = msg_scroll;
                      > -
                      > - if (no_spell_checking(curwin))
                      > + int wo_spell_save;
                      > +
                      > +/* if (no_spell_checking(curwin))
                      > + return; */
                      > + wo_spell_save = curwin->w_p_spell;
                      > +
                      > + if (!curwin->w_p_spell)
                      > + {
                      > + did_set_spelllang(curwin);
                      > + curwin->w_p_spell = TRUE;
                      > + }
                      > +
                      > + if (*curwin->w_s->b_p_spl == NUL)
                      > + {
                      > + EMSG(_("E756: Spell checking is not possible"));
                      > return;
                      > + }
                      > +
                      >
                      > #ifdef FEAT_VISUAL
                      > if (VIsual_active)
                      > @@ -10377,6 +10392,7 @@
                      > spell_find_cleanup(&sug);
                      > skip:
                      > vim_free(line);
                      > + curwin->w_p_spell = wo_spell_save;
                      > }
                      >
                      > /*

                      Hello Christian,

                      Sorry for checking this so late, but the patch indeed works for me. I see that
                      it's already in the todo list with a remark to also apply this to spellbadword()
                      and spellsuggest().

                      -- regards, ingo

                      --
                      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
                    • Gary Johnson
                      ... Now that 7.4 has been released and we can resume considering features instead of just bug fixes, can we have this patch included? If it isn t high on
                      Message 10 of 18 , Aug 10, 2013
                        On 2012-08-05, Christian Brabandt wrote:

                        > Does this patch work for you?
                        >
                        > diff --git a/src/spell.c b/src/spell.c
                        > --- a/src/spell.c
                        > +++ b/src/spell.c
                        > @@ -10155,9 +10155,24 @@
                        > int selected = count;
                        > int badlen = 0;
                        > int msg_scroll_save = msg_scroll;
                        > -
                        > - if (no_spell_checking(curwin))
                        > + int wo_spell_save;
                        > +
                        > +/* if (no_spell_checking(curwin))
                        > + return; */
                        > + wo_spell_save = curwin->w_p_spell;
                        > +
                        > + if (!curwin->w_p_spell)
                        > + {
                        > + did_set_spelllang(curwin);
                        > + curwin->w_p_spell = TRUE;
                        > + }
                        > +
                        > + if (*curwin->w_s->b_p_spl == NUL)
                        > + {
                        > + EMSG(_("E756: Spell checking is not possible"));
                        > return;
                        > + }
                        > +
                        >
                        > #ifdef FEAT_VISUAL
                        > if (VIsual_active)
                        > @@ -10377,6 +10392,7 @@
                        > spell_find_cleanup(&sug);
                        > skip:
                        > vim_free(line);
                        > + curwin->w_p_spell = wo_spell_save;
                        > }
                        >
                        > /*

                        Now that 7.4 has been released and we can resume considering
                        features instead of just bug fixes, can we have this patch included?
                        If it isn't high on Bram's list, then Christian, would you please
                        post a patch that works with 7.4? I tried applying this patch to
                        7.4 and all I got was "2 out of 2 hunks FAILED". I didn't look into
                        why it failed.

                        Regards,
                        Gary

                        --
                        --
                        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 vim_dev+unsubscribe@....
                        For more options, visit https://groups.google.com/groups/opt_out.
                      • Christian Brabandt
                        ... I applies to me with a certain offset for me. But anyway here is an improved version, that also does, what the todo entry suggesgs: ,---- ... `---- BTW, if
                        Message 11 of 18 , Aug 11, 2013
                          On Sa, 10 Aug 2013, Gary Johnson wrote:

                          > On 2012-08-05, Christian Brabandt wrote:
                          >
                          > > Does this patch work for you?
                          > >
                          > > diff --git a/src/spell.c b/src/spell.c
                          > > --- a/src/spell.c
                          > > +++ b/src/spell.c
                          > > @@ -10155,9 +10155,24 @@
                          > > int selected = count;
                          > > int badlen = 0;
                          > > int msg_scroll_save = msg_scroll;
                          > > -
                          > > - if (no_spell_checking(curwin))
                          > > + int wo_spell_save;
                          > > +
                          > > +/* if (no_spell_checking(curwin))
                          > > + return; */
                          > > + wo_spell_save = curwin->w_p_spell;
                          > > +
                          > > + if (!curwin->w_p_spell)
                          > > + {
                          > > + did_set_spelllang(curwin);
                          > > + curwin->w_p_spell = TRUE;
                          > > + }
                          > > +
                          > > + if (*curwin->w_s->b_p_spl == NUL)
                          > > + {
                          > > + EMSG(_("E756: Spell checking is not possible"));
                          > > return;
                          > > + }
                          > > +
                          > >
                          > > #ifdef FEAT_VISUAL
                          > > if (VIsual_active)
                          > > @@ -10377,6 +10392,7 @@
                          > > spell_find_cleanup(&sug);
                          > > skip:
                          > > vim_free(line);
                          > > + curwin->w_p_spell = wo_spell_save;
                          > > }
                          > >
                          > > /*
                          >
                          > Now that 7.4 has been released and we can resume considering
                          > features instead of just bug fixes, can we have this patch included?
                          > If it isn't high on Bram's list, then Christian, would you please
                          > post a patch that works with 7.4? I tried applying this patch to
                          > 7.4 and all I got was "2 out of 2 hunks FAILED". I didn't look into
                          > why it failed.

                          I applies to me with a certain offset for me. But anyway here is an
                          improved version, that also does, what the todo entry suggesgs:

                          ,----
                          | Patch to make "z=" work when 'spell' is off. Does this have nasty side
                          | effects? (Christian Brabandt, 2012 Aug 5)
                          | Would also need to do this for spellbadword() and spellsuggest().
                          `----

                          BTW, if you encounter such nasty side-effects, just tell me and I'll look into it.

                          Mit freundlichen Grüßen
                          Christian
                          --

                          --
                          --
                          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 vim_dev+unsubscribe@....
                          For more options, visit https://groups.google.com/groups/opt_out.
                        • Gary Johnson
                          Christian, ... Thank you, but I did not receive a new patch. Was one supposed to be attached to your message? Regards, Gary -- -- You received this message
                          Message 12 of 18 , Aug 11, 2013
                            Christian,

                            On 2013-08-11, Christian Brabandt wrote:
                            > On Sa, 10 Aug 2013, Gary Johnson wrote:

                            > > Now that 7.4 has been released and we can resume considering
                            > > features instead of just bug fixes, can we have this patch included?
                            > > If it isn't high on Bram's list, then Christian, would you please
                            > > post a patch that works with 7.4? I tried applying this patch to
                            > > 7.4 and all I got was "2 out of 2 hunks FAILED". I didn't look into
                            > > why it failed.
                            >
                            > I applies to me with a certain offset for me. But anyway here is an
                            > improved version, that also does, what the todo entry suggesgs:
                            >
                            > ,----
                            > | Patch to make "z=" work when 'spell' is off. Does this have nasty side
                            > | effects? (Christian Brabandt, 2012 Aug 5)
                            > | Would also need to do this for spellbadword() and spellsuggest().
                            > `----

                            Thank you, but I did not receive a new patch. Was one supposed to
                            be attached to your message?

                            Regards,
                            Gary

                            --
                            --
                            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 vim_dev+unsubscribe@....
                            For more options, visit https://groups.google.com/groups/opt_out.
                          • Christian Brabandt
                            Hi Gary! ... Argl, I feel so old. And I even wrote a Vim plugin¹, that is supposed to prevent making me look silly, but I didn t even mention the word
                            Message 13 of 18 , Aug 12, 2013
                              Hi Gary!

                              On So, 11 Aug 2013, Gary Johnson wrote:

                              > Christian,
                              >
                              > On 2013-08-11, Christian Brabandt wrote:
                              > > On Sa, 10 Aug 2013, Gary Johnson wrote:
                              >
                              > > > Now that 7.4 has been released and we can resume considering
                              > > > features instead of just bug fixes, can we have this patch included?
                              > > > If it isn't high on Bram's list, then Christian, would you please
                              > > > post a patch that works with 7.4? I tried applying this patch to
                              > > > 7.4 and all I got was "2 out of 2 hunks FAILED". I didn't look into
                              > > > why it failed.
                              > >
                              > > I applies to me with a certain offset for me. But anyway here is an
                              > > improved version, that also does, what the todo entry suggesgs:
                              > >
                              > > ,----
                              > > | Patch to make "z=" work when 'spell' is off. Does this have nasty side
                              > > | effects? (Christian Brabandt, 2012 Aug 5)
                              > > | Would also need to do this for spellbadword() and spellsuggest().
                              > > `----
                              >
                              > Thank you, but I did not receive a new patch. Was one supposed to
                              > be attached to your message?

                              Argl, I feel so old. And I even wrote a Vim plugin¹, that is supposed to
                              prevent making me look silly, but I didn't even mention the word
                              "attach" in my message.

                              Oh well, here is an updated version attached. Yes, it is really
                              attached...


                              hopefully ;)

                              ¹) http://www.vim.org/scripts/script.php?script_id=2796

                              Mit freundlichen Grüßen
                              Christian
                              --
                              Es wäre gut, Bücher zu kaufen, wenn man die Zeit, sie zu lesen,
                              mitkaufen könnte.
                              -- Arthur Schopenhauer

                              --
                              --
                              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 vim_dev+unsubscribe@....
                              For more options, visit https://groups.google.com/groups/opt_out.
                            • Gary Johnson
                              ... That makes two of us. While applying your new patch I found out why your original patch failed: I was using -p0 and didn t even try -p1. Using -p1 your
                              Message 14 of 18 , Aug 12, 2013
                                On 2013-08-12, Christian Brabandt wrote:
                                > Hi Gary!
                                >
                                > On So, 11 Aug 2013, Gary Johnson wrote:
                                >
                                > > Christian,
                                > >
                                > > On 2013-08-11, Christian Brabandt wrote:
                                > > > On Sa, 10 Aug 2013, Gary Johnson wrote:
                                > >
                                > > > > Now that 7.4 has been released and we can resume considering
                                > > > > features instead of just bug fixes, can we have this patch included?
                                > > > > If it isn't high on Bram's list, then Christian, would you please
                                > > > > post a patch that works with 7.4? I tried applying this patch to
                                > > > > 7.4 and all I got was "2 out of 2 hunks FAILED". I didn't look into
                                > > > > why it failed.
                                > > >
                                > > > I applies to me with a certain offset for me. But anyway here is an
                                > > > improved version, that also does, what the todo entry suggesgs:
                                > > >
                                > > > ,----
                                > > > | Patch to make "z=" work when 'spell' is off. Does this have nasty side
                                > > > | effects? (Christian Brabandt, 2012 Aug 5)
                                > > > | Would also need to do this for spellbadword() and spellsuggest().
                                > > > `----
                                > >
                                > > Thank you, but I did not receive a new patch. Was one supposed to
                                > > be attached to your message?
                                >
                                > Argl, I feel so old. And I even wrote a Vim pluginš, that is supposed to
                                > prevent making me look silly, but I didn't even mention the word
                                > "attach" in my message.

                                That makes two of us. While applying your new patch I found out why
                                your original patch failed: I was using -p0 and didn't even try
                                -p1. Using -p1 your original patch applied just fine with an offset
                                of 3.

                                > 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.

                                Regards,
                                Gary

                                --
                                --
                                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 vim_dev+unsubscribe@....
                                For more options, visit https://groups.google.com/groups/opt_out.
                              • Gary Johnson
                                ... 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=.
                                Message 15 of 18 , Sep 7 1:44 PM
                                  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.

                                  Regards,
                                  Gary

                                  --
                                  --
                                  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 vim_dev+unsubscribe@....
                                  For more options, visit https://groups.google.com/groups/opt_out.
                                • Christian Brabandt
                                  ... 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
                                  Message 16 of 18 , Sep 8 5:27 AM
                                    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 vim_dev+unsubscribe@....
                                    For more options, visit https://groups.google.com/groups/opt_out.
                                  • Gary Johnson
                                    ... Your message arrived with its tabs expanded to spaces, but once I fixed that, I was able to apply both patches. Thanks. Regards, Gary -- -- You received
                                    Message 17 of 18 , Sep 8 2:19 PM
                                      On 2013-09-08, Christian Brabandt wrote:
                                      > On Sa, 07 Sep 2013, Gary Johnson wrote:

                                      > > I just noticed an odd behavior of the spell feature with your patch
                                      > > included. ...

                                      > That is actually a strange behaviour of normal Vim and has nothing to do
                                      > with my patch.
                                      ...
                                      > Here is a patch, that prevents the spurious E756 error in the case of 'zg/zb'
                                      ...
                                      > And this patch, explicitly tells the user, what word has been
                                      > removed/added to the spellfile:

                                      Your message arrived with its tabs expanded to spaces, but once I
                                      fixed that, I was able to apply both patches. Thanks.

                                      Regards,
                                      Gary

                                      --
                                      --
                                      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 vim_dev+unsubscribe@....
                                      For more options, visit https://groups.google.com/groups/opt_out.
                                    • Bram Moolenaar
                                      ... Isn t the problem that zw is intended to use the word under the cursor, but it uses the next word marked as misspelled? I haven t actually tried it...
                                      Message 18 of 18 , Sep 10 2:44 AM
                                        Christian Brabandt wrote:

                                        > 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).

                                        Isn't the problem that "zw" is intended to use the word under the
                                        cursor, but it uses the next word marked as misspelled? I haven't
                                        actually tried it...

                                        > Here is a patch, that prevents the spurious E756 error in the case of 'zg/zb'

                                        Thanks.

                                        --
                                        Some of the well known MS-Windows errors:
                                        EHUH Unexpected error
                                        EUSER User error, not our fault!
                                        EGOD Horrible problem, god knows what has happened
                                        EERR Errornous error: nothing wrong

                                        /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
                                        /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
                                        \\\ an exciting new programming language -- http://www.Zimbu.org ///
                                        \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

                                        --
                                        --
                                        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 vim_dev+unsubscribe@....
                                        For more options, visit https://groups.google.com/groups/opt_out.
                                      Your message has been successfully submitted and would be delivered to recipients shortly.