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

Re: mail syntax file update (spell errors with vim7).

Expand Messages
  • Bram Moolenaar
    ... Very good. ... I don t think this version should go in the 6.3 runtime. I ll include it and see if I can find something I don t like. ... The flags for
    Message 1 of 5 , Jun 2, 2005
    • 0 Attachment
      Gautam Iyerwrote:

      > Since Johannes brought up the spell highlighting buisness, it caused me
      > to get off my butt and update the mail syntax file to include vim7's
      > wonderfull spell system :)

      Very good.

      > It's attached. Bram -- I don't know if you want to include this in the
      > vim6.x runtime directory or not, since I don't know how the 'NoSpell'
      > cluster behaves with the popular spell scripts. (I know that anything
      > with a @Spell cluster is checked for spelling by some scripts, but I'm
      > not sure if the @NoSpell is even possible with scripts in vim6).

      I don't think this version should go in the 6.3 runtime. I'll include
      it and see if I can find something I don't like.

      > I have also set it up so that spell errors in the subject / signature
      > are caught, but nothing in quoted text (including subjects / signatures)
      > are caught. This is generally how I like it, but if there are people who
      > feel differently let me know and I'll add an option :)
      >
      > Finally -- I noticed the following (possible bug):

      The flags for the Spell and Nospell clusters were not reset on a ":syn
      clear". This patch should fix it. But look out for any other problems,
      the paint is still wet on the spell code :-).

      *** syntax.c~ Wed Jun 1 18:07:43 2005
      --- syntax.c Thu Jun 2 11:01:30 2005
      ***************
      *** 3143,3148 ****
      --- 3143,3150 ----
      for (i = buf->b_syn_clusters.ga_len; --i >= 0; )
      syn_clear_cluster(buf, i);
      ga_clear(&buf->b_syn_clusters);
      + buf->b_spell_cluster_id = 0;
      + buf->b_nospell_cluster_id = 0;

      buf->b_syn_sync_flags = 0;
      buf->b_syn_sync_minlines = 0;

      > Also noticed the following *neat* feature -- On cterm badly spelt words
      > only have the background red, and the foreground the correct syntax
      > color. Wow. How cool is that :).

      To try out if I could make that work was the direct cause for starting
      to work on the spell code. Got carried away a bit...

      > So naturally I tried something like
      >
      > :hi Visual ctermfg=NONE ctermbg=darkblue
      >
      > etc. But unfortunately the same doesn't work. I all selected text is
      > still blue in background and white foreground :(. Is there something
      > special in the spell code that makes this work? It would be kinda cool
      > to have this for everything else too (especially selected text and
      > searches. this doesn't matter so much for other groups).

      Yes, there is something special in the spell code. Could use this for
      the syntax highlighting too. Try this patch and look out for things
      that go wrong:

      --- screen.c 20 May 2005 21:24:30 -0000 1.23
      +++ screen.c 2 Jun 2005 09:15:40 -0000
      @@ -3586,6 +3586,8 @@

      if (area_attr == 0 && search_attr == 0)
      char_attr = syntax_attr;
      + else
      + char_attr = hl_combine_attr(char_attr, syntax_attr);
      }

      /* Check spelling at the start of a word.

      > PS: Incase I did not say so already, the spell feature looks *GREAT*.
      > Thanks a *TON*. I don't know if you plan on implementing replacement
      > suggestions or not, but that part is not as usefull (and can easily
      > be implemented by piping to aspell or somehting). Thanks again!

      I haven't looked into making suggestions yet. If the code is not too
      complicated I could include it, otherwise I'll leave it to a library.
      Disadvantage of the last is that the Vim word lists may differ from what
      the library uses, thus you might get conflicting suggestions.

      What program gives the best suggestions, aspell, myspell
      (OpenOffice/Mozilla), others?

      --
      How To Keep A Healthy Level Of Insanity:
      3. Every time someone asks you to do something, ask if they want fries
      with that.

      /// Bram Moolenaar -- Bram@... -- 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 ///
    • drchip@campbellfamily.biz
      Quoting Bram Moolenaar : ... May I humbly repeat my suggestion about agrep -- approximate grep . Such a feature could come in handy in
      Message 2 of 5 , Jun 2, 2005
      • 0 Attachment
        Quoting Bram Moolenaar <Bram@...>:

        ...
        > I haven't looked into making suggestions yet. If the code is not too
        > complicated I could include it, otherwise I'll leave it to a library.
        > Disadvantage of the last is that the Vim word lists may differ from what
        > the library uses, thus you might get conflicting suggestions.
        >
        > What program gives the best suggestions, aspell, myspell
        > (OpenOffice/Mozilla), others?

        May I humbly repeat my suggestion about agrep -- "approximate grep".
        Such a feature could come in handy in regular use of vim. Ie. looking
        for everything that is approximately some word. Engspchk uses agrep
        as an external tool (naturally) to search the same word database it uses
        for syntax-highlighting based spellchecking.

        Regards,
        Chip Campbell
      • GI
        On Thu, Jun 02, 2005 at 12:20:27PM +0200, Bram Moolenaar wrote: Thanks for the patches Bram. They seem to work fine so far :). I will test it some more later
        Message 3 of 5 , Jun 2, 2005
        • 0 Attachment
          On Thu, Jun 02, 2005 at 12:20:27PM +0200, Bram Moolenaar wrote:

          Thanks for the patches Bram. They seem to work fine so far :). I will
          test it some more later today.

          > > PS: Incase I did not say so already, the spell feature looks *GREAT*.
          > > Thanks a *TON*. I don't know if you plan on implementing replacement
          > > suggestions or not, but that part is not as usefull (and can easily
          > > be implemented by piping to aspell or somehting). Thanks again!
          >
          > I haven't looked into making suggestions yet. If the code is not too
          > complicated I could include it, otherwise I'll leave it to a library.
          > Disadvantage of the last is that the Vim word lists may differ from what
          > the library uses, thus you might get conflicting suggestions.
          >
          > What program gives the best suggestions, aspell, myspell
          > (OpenOffice/Mozilla), others?

          According to the aspell website, no other program (myspell, msword etc)
          comes close to aspell in this. In my experience so far, aspell has been
          *great* in suggesting replacements (the newest version learns while
          suggesting). I have no experience with agrep though, so I can't compare.
          Mabye someone else has used both, and can give a better idea? Again,
          personally I think it's easy to implement this part using scripts, so I
          wouldn't mind too much if vim7 had no suggestion mechanism.

          Since we're talking about spelling again I have one more suggestion:
          (maybe this came up already, or maybe this is already possible). I would
          like to mark words in the current buffer to be ignored while spelling.
          (For instance 'vim' gets highlighted as an error while viewing help
          files). Any chance of having a 'spellignore' option listing all bad
          words? Or having a 'spellignorefile' option pointing to a file that
          lists all bad words (in clear text). Better still having both? (This way
          a few bad words can be set by a modeline, and the user's list of custom
          words can be stored in a special file. This aproach helps greatly when
          typing for instance latex documents. All math geek terms can be stored
          in a ~/.mathgeek file, and the user can use

          :au bufread,bufnewfile *.tex setlocal spellignorefile=~/.mathgeek

          With these options it's easy to write scripts/mappings to add the
          current word to either spellignore or spellignorefile :). Or you can
          include them by default.

          Just a thought :)

          Gautam

          --
          A man's home is his castle, in a manor of speaking.
        • Bram Moolenaar
          ... I will have a look at aspell later. However, I expect to run into the problem that the aspell code is very difficult to understand. I had that problem
          Message 4 of 5 , Jun 3, 2005
          • 0 Attachment
            Gautam Iyer wrote:

            > > > PS: Incase I did not say so already, the spell feature looks *GREAT*.
            > > > Thanks a *TON*. I don't know if you plan on implementing replacement
            > > > suggestions or not, but that part is not as usefull (and can easily
            > > > be implemented by piping to aspell or somehting). Thanks again!
            > >
            > > I haven't looked into making suggestions yet. If the code is not too
            > > complicated I could include it, otherwise I'll leave it to a library.
            > > Disadvantage of the last is that the Vim word lists may differ from what
            > > the library uses, thus you might get conflicting suggestions.
            > >
            > > What program gives the best suggestions, aspell, myspell
            > > (OpenOffice/Mozilla), others?
            >
            > According to the aspell website, no other program (myspell, msword etc)
            > comes close to aspell in this. In my experience so far, aspell has been
            > *great* in suggesting replacements (the newest version learns while
            > suggesting). I have no experience with agrep though, so I can't compare.
            > Mabye someone else has used both, and can give a better idea? Again,
            > personally I think it's easy to implement this part using scripts, so I
            > wouldn't mind too much if vim7 had no suggestion mechanism.

            I will have a look at aspell later. However, I expect to run into the
            problem that the aspell code is very difficult to understand. I had
            that problem when looking at the basic spell checking code. The Myspell
            author had the same problem.

            > Since we're talking about spelling again I have one more suggestion:
            > (maybe this came up already, or maybe this is already possible). I would
            > like to mark words in the current buffer to be ignored while spelling.
            > (For instance 'vim' gets highlighted as an error while viewing help
            > files). Any chance of having a 'spellignore' option listing all bad
            > words? Or having a 'spellignorefile' option pointing to a file that
            > lists all bad words (in clear text). Better still having both? (This way
            > a few bad words can be set by a modeline, and the user's list of custom
            > words can be stored in a special file. This aproach helps greatly when
            > typing for instance latex documents. All math geek terms can be stored
            > in a ~/.mathgeek file, and the user can use
            >
            > :au bufread,bufnewfile *.tex setlocal spellignorefile=~/.mathgeek
            >
            > With these options it's easy to write scripts/mappings to add the
            > current word to either spellignore or spellignorefile :). Or you can
            > include them by default.

            In Vim spell terminology you don't ignore words, you add words to a word
            list and tell Vim to use it. The implementation of user/project/system
            word lists and commands to quickly add a word to them is still to be done.

            Something else would be to explicitly mark a word as bad. This is
            useful if a word is in a system dictionary but you want to avoid it
            anyway (e.g, "vim" is in the dictionary but you always want to use
            "Vim"). A suggestion for correction would need to come with it.

            --
            How To Keep A Healthy Level Of Insanity:
            17. When the money comes out the ATM, scream "I won!, I won! 3rd
            time this week!!!!!"

            /// Bram Moolenaar -- Bram@... -- 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 ///
          Your message has been successfully submitted and would be delivered to recipients shortly.