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

FileType bug ?

Expand Messages
  • Martin [Keso] Keseg
    Hi, I m trying customize my vim with filetype options and I got some strange results: ... au FileType mail source ~/.vim/mail where ~/.vim/mail is: se tw=80
    Message 1 of 7 , Aug 1, 2000
    • 0 Attachment
      Hi,

      I'm trying customize my vim with filetype options and I got some strange
      results:

      I have defined in my .vimrc (only these 2 lines):

      :filetype on
      au FileType mail source ~/.vim/mail

      where ~/.vim/mail is:

      se tw=80
      :syntax on


      vim 5.7 and mutt:

      Error detected while processing /usr/local/share/vim/vim57/syntax/nosyntax.vim:
      line 15:
      autocommand nesting too deep
      Error detected while processing /usr/local/share/vim/vim57/syntax/syntax.vim:
      line 30:
      autocommand nesting too deep

      vim 6.0d and mutt:

      no errors but no syntax highlighting.

      :set ft
      filetype=mail
      :syntax
      No Syntax items defined for this buffer

      I get colors after setting :set syntax mail. I think, this should be automatic after
      :syntax on, which is in ~/.vim/mail.

      --
      Keso
      Very bad. VERY BAD.
      Sorry about that...
    • Michael Geddes
      Try putting syntax on in your .vimrc , not ~/.vim/mail //. ... From: Martin [Keso] Keseg [SMTP:Martin.Keseg@slovakia.sun.com] Sent: Tuesday, 1 August 2000
      Message 2 of 7 , Aug 1, 2000
      • 0 Attachment
        Try putting syntax on in your .vimrc , not ~/.vim/mail

        //.

        -----Original Message-----
        From: Martin [Keso] Keseg [SMTP:Martin.Keseg@...]
        Sent: Tuesday, 1 August 2000 17:55
        To: Vim Dev Mailing List
        Subject: FileType bug ?

        Hi,

        I'm trying customize my vim with filetype options and I got some
        strange
        results:

        I have defined in my .vimrc (only these 2 lines):

        :filetype on
        au FileType mail source ~/.vim/mail

        where ~/.vim/mail is:

        se tw=80
        :syntax on


        vim 5.7 and mutt:

        Error detected while processing
        /usr/local/share/vim/vim57/syntax/nosyntax.vim:
        line 15:
        autocommand nesting too deep
        Error detected while processing
        /usr/local/share/vim/vim57/syntax/syntax.vim:
        line 30:
        autocommand nesting too deep

        vim 6.0d and mutt:

        no errors but no syntax highlighting.

        :set ft
        filetype=mail
        :syntax
        No Syntax items defined for this buffer

        I get colors after setting :set syntax mail. I think, this should be
        automatic after
        :syntax on, which is in ~/.vim/mail.

        --
        Keso
        Very bad. VERY BAD.
        Sorry about that...
      • Martin [Keso] Keseg
        ... Well, I don t want syntax highliting in every instance of vim, I need syntax only when I m writing email. -- Keso Very bad. VERY BAD. Sorry about that...
        Message 3 of 7 , Aug 1, 2000
        • 0 Attachment
          Michael Geddes (mgeddes@...) wrote :

          > Try putting syntax on in your .vimrc , not ~/.vim/mail
          >
          Well, I don't want syntax highliting in every instance of vim, I need syntax
          only when I'm writing email.

          --
          Keso
          Very bad. VERY BAD.
          Sorry about that...
        • Michael Geddes
          Looks like syntax manual in the _vimrc and set syntax=mail in your ~/.vim/mail should do the trick. //. ... From: Martin [Keso] Keseg
          Message 4 of 7 , Aug 1, 2000
          • 0 Attachment
            Looks like

            syntax manual
            in the _vimrc

            and

            set syntax=mail
            in your ~/.vim/mail

            should do the trick.

            //.

            -----Original Message-----
            From: Martin [Keso] Keseg [SMTP:Martin.Keseg@...]
            Sent: Tuesday, 1 August 2000 18:41
            To: Vim Dev Mailing List
            Subject: Re: FileType bug ?

            Michael Geddes (mgeddes@...) wrote :

            > Try putting syntax on in your .vimrc , not ~/.vim/mail
            >
            Well, I don't want syntax highliting in every instance of vim, I
            need syntax
            only when I'm writing email.

            --
            Keso
            Very bad. VERY BAD.
            Sorry about that...
          • Bram Moolenaar
            ... Doing :syntax on has a side effect: It will trigger the filetype events, so that the syntax highlighting will be switched on for all buffers currently
            Message 5 of 7 , Aug 1, 2000
            • 0 Attachment
              Martin Keseg wrote:

              > I'm trying customize my vim with filetype options and I got some strange
              > results:
              >
              > I have defined in my .vimrc (only these 2 lines):
              >
              > :filetype on
              > au FileType mail source ~/.vim/mail
              >
              > where ~/.vim/mail is:
              >
              > se tw=80
              > :syntax on
              >
              >
              > vim 5.7 and mutt:
              >
              > Error detected while processing /usr/local/share/vim/vim57/syntax/nosyntax.vim:
              > line 15:
              > autocommand nesting too deep
              > Error detected while processing /usr/local/share/vim/vim57/syntax/syntax.vim:
              > line 30:
              > autocommand nesting too deep
              >
              > vim 6.0d and mutt:
              >
              > no errors but no syntax highlighting.

              Doing ":syntax on" has a side effect: It will trigger the filetype events, so
              that the syntax highlighting will be switched on for all buffers currently
              open. Since you use the filetype event to switch on syntax highlighting, you
              get an endless loop.

              The solution for you is using this in ~/.vim/mail:

              if !exists("syntax_on")
              syntax on
              endif

              I could try to trigger only the "syntaxset" autocommands. That requires
              detecting that the filetypes are already detected. Try using this
              $VIMRUNTIME/syntax/syntax.vim instead:

              " Vim syntax support file
              " Maintainer: Bram Moolenaar <Bram@...>
              " Last Change: 2000 Aug 01

              " This file is used for ":syntax on".
              " It installs the autocommands and starts highlighting for all buffers.

              if !has("syntax")
              finish
              endif

              " If Syntax highlighting appears to be on already, turn it off first, so that
              " any leftovers are cleared.
              if exists("syntax_on") || exists("syntax_manual")
              so <sfile>:p:h/nosyntax.vim
              endif

              " Load the Syntax autocommands and set the default methods for highlighting.
              so <sfile>:p:h/synload.vim

              " Load the FileType autocommands if not done yet.
              if exists("did_load_filetypes")
              let s:did_ft = 1
              else
              filetype on
              let s:did_ft = 0
              endif

              " Set up the connection between FileType and Syntax autocommands.
              " This makes the syntax automatically set when the file type is detected.
              augroup syntaxset
              au! FileType * exe "set syntax=" . expand("<amatch>")
              augroup END


              " Execute the syntax autocommands for the each buffer.
              " If the filetype wasn't detected yet, do that now.
              if s:did_ft
              doautoall syntaxset FileType
              else
              doautoall filetypedetect BufRead
              endif

              --
              ERROR 047: Keyboard not found. Press RETURN to continue.

              /// Bram Moolenaar Bram@... http://www.moolenaar.net \\\
              \\\ Vim: http://www.vim.org ICCF Holland: http://iccf-holland.org ///
            • Martin [Keso] Keseg
              ... test results: vim 5.7 and new syntax.vim ~/.vim/mail contains only :syntax on /tmp/mutt-krowak-14690-3 37L, 903C Error detected while processing
              Message 6 of 7 , Aug 1, 2000
              • 0 Attachment
                Bram Moolenaar (Bram@...) wrote :


                > Doing ":syntax on" has a side effect: It will trigger the filetype events, so
                > that the syntax highlighting will be switched on for all buffers currently
                > open. Since you use the filetype event to switch on syntax highlighting, you
                > get an endless loop.
                >
                > The solution for you is using this in ~/.vim/mail:
                >
                > if !exists("syntax_on")
                > syntax on
                > endif
                >
                > I could try to trigger only the "syntaxset" autocommands. That requires
                > detecting that the filetypes are already detected. Try using this
                > $VIMRUNTIME/syntax/syntax.vim instead:

                test results:

                vim 5.7 and new syntax.vim

                ~/.vim/mail contains only :syntax on

                "/tmp/mutt-krowak-14690-3" 37L, 903C
                Error detected while processing /usr/local/share/vim/vim57/syntax/syntax.vim:
                line 38:
                Undefined variable: s:did_ft
                Invalid expression: s:did_ft
                line 40:
                :else without :if: else
                line 41:
                No such event: filetypedetect BufRead
                line 42:
                :endif without :if: endif
                Press RETURN or enter command to continue

                I got the same error with if !exists("syntax_on")... in ~/.vim/mail

                vim 5.7 and old syntax.vim(default from instalation)

                the if !exists("syntax_on")... workaround works.

                vim 6.0d new syntax.vim

                the if !exists("syntax_on")... workaround does not works.

                vim 6.0d and old syntax.vim

                the if !exists("syntax_on")... workaround does not works too :-(


                --
                Keso
                Very bad. VERY BAD.
                Sorry about that...
              • Bram Moolenaar
                ... Won t work. This syntax.vim I sent was made for Vim 6.0d. It uses the new script-local s: variables. ... OK. ... Strange. There must be something else
                Message 7 of 7 , Aug 1, 2000
                • 0 Attachment
                  Martin Keseg wrote:

                  > test results:
                  >
                  > vim 5.7 and new syntax.vim

                  Won't work. This syntax.vim I sent was made for Vim 6.0d. It uses the new
                  script-local s: variables.

                  > vim 5.7 and old syntax.vim(default from instalation)
                  >
                  > the if !exists("syntax_on")... workaround works.

                  OK.

                  > vim 6.0d new syntax.vim
                  >
                  > the if !exists("syntax_on")... workaround does not works.
                  >
                  > vim 6.0d and old syntax.vim
                  >
                  > the if !exists("syntax_on")... workaround does not works too :-(

                  Strange. There must be something else interfering. Try setting the 'verbose'
                  option and find out what happens.

                  --
                  hundred-and-one symptoms of being an internet addict:
                  63. You start using smileys in your snail mail.

                  /// Bram Moolenaar Bram@... http://www.moolenaar.net \\\
                  \\\ Vim: http://www.vim.org ICCF Holland: http://iccf-holland.org ///
                Your message has been successfully submitted and would be delivered to recipients shortly.