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

Re: Vim-7.4 no longer recognizes some mail files by file name

Expand Messages
  • Manuel Ortega
    ... I did some snooping. First, I can confirm the problem on OSX 10.8.4. Second, bisection has revealed that the commit that caused the issue is 7.3.1295.
    Message 1 of 5 , Jul 30, 2013
    • 0 Attachment
      On Mon, Jul 29, 2013 at 8:36 PM, Gary Johnson <garyjohn@...> wrote:
      I just noticed this today with 7.4b but the behavior is the same
      with 7.4a.9.  It works correctly with 7.3.882.

      The problem is that when I open a temporary file created by mutt
      with the name /tmp/muttV1LGjR, the latest versions of vim do not
      recognize this as a file name that should set 'filetype' to "mail".

      The experiment I performed was to copy that file to my home
      directory and execute

          vim -N -u NONE --cmd 'syntax on' muttV1LGjR

      for the three versions of vim mentioned above.

      For version 7.3.882, the file is syntax highlighted and
      'filtype' is "mail".  For the 7.4 versions, the file is not syntax
      highlighted and 'filetype' is emtpy.

      This should be detected by both of the following patterns in
      $VIMRUNTIME/filetype.vim:

          mutt[[:alnum:]_-]\{6\}
          mutt[[:alnum:]._-]\{6\}

      Both of those patterns successfully match "muttV1LGjR" when it
      appears as a string in a file and the pattern is used after a /
      command.

      That's as far as I've investigated this.

      I did some snooping.  First, I can confirm the problem on OSX 10.8.4.  Second, bisection has revealed that the commit that caused the issue is 7.3.1295.  7.3.1294 and earlier are OK.  As to what it is about 1295 that did it, I have zero relevant expertise.

      -Manny 

      --
      --
      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.
       
       
    • Manuel Ortega
      ... From vimgrepping in $VIMRUNTIME/filetype.vim, I see that mutt patterns are the ONLY ones that include, in the pattern for the BufNewFile,BufRead autocmds,
      Message 2 of 5 , Jul 30, 2013
      • 0 Attachment



        On Tue, Jul 30, 2013 at 12:05 PM, Manuel Ortega <mannyvimdev@...> wrote:
        On Mon, Jul 29, 2013 at 8:36 PM, Gary Johnson <garyjohn@...> wrote:

        This should be detected by both of the following patterns in
        $VIMRUNTIME/filetype.vim:

            mutt[[:alnum:]_-]\{6\}
            mutt[[:alnum:]._-]\{6\}

        Both of those patterns successfully match "muttV1LGjR" when it
        appears as a string in a file and the pattern is used after a /
        command.

        That's as far as I've investigated this.

        I did some snooping.  First, I can confirm the problem on OSX 10.8.4.  Second, bisection has revealed that the commit that caused the issue is 7.3.1295.  7.3.1294 and earlier are OK.  As to what it is about 1295 that did it, I have zero relevant expertise.

        From vimgrepping in $VIMRUNTIME/filetype.vim, I see that mutt patterns are the ONLY ones that include, in the pattern for the BufNewFile,BufRead autocmds, backslash-escaped curly braces.

        And I can see by looking at the diffs for 7.3.1295 (the offending patch) in the googlecode page, that in fileio.c, there is a note that says "An escaped { must be unescaped", followed by some code that (I presume) does just that.  There's the problem.

        By the way, I am a bit surprised that the aforementioned patterns in filetype.vim EVER worked.  Nothing in :h autocmd-pattern or :h file-pattern suggests that the vim text regex elements '\{' or '\}'---used as quantifiers like with \{6\} or \{-n\}--- are kosher for use in autocmds.  Instead those help files seem to say that we only have a relatively small set of patterns that are only slightly better than globbing wildcards.

        For that matter, the mutt patterns are part of a grand total of FOUR that try to use something like [:alnum:] in them, and nothing in the help files says *that* should work either!

        Are the docs underselling what's available for use in autocmd file-matching patterns?  Bram, if '\{n\}' *is* kosher for autocmd file-patterns, please say so in the docs.  Ditto for anything else left out like [:blah:]

        If OTOH the docs are not underselling, then the autocmds in filetype.vim that attempt to use \{n\} and [:blah:] are incorrect and should be replaced.

        -Manny

        --
        --
        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.
         
         
      • Ingo Karkat
        ... On a related note, I found several instances of the ** pattern in runtime/filetype.vim, even though a single * would suffice. I guess the author was
        Message 3 of 5 , Aug 2, 2013
        • 0 Attachment
          On 30-Jul-2013 22:40 +0200, Manuel Ortega wrote:

          > [34 lines deleted]
          >
          > By the way, I am a bit surprised that the aforementioned patterns in
          > filetype.vim EVER worked. Nothing in :h autocmd-pattern or :h
          > file-pattern suggests that the vim text regex elements '\{' or
          > '\}'---used as quantifiers like with \{6\} or \{-n\}--- are kosher for
          > use in autocmds. Instead those help files seem to say that we only have
          > a relatively small set of patterns that are only slightly better than
          > globbing wildcards.
          >
          > For that matter, the mutt patterns are part of a grand total of FOUR
          > that try to use something like [:alnum:] in them, and nothing in the
          > help files says *that* should work either!
          >
          > Are the docs underselling what's available for use in autocmd
          > file-matching patterns? Bram, if '\{n\}' *is* kosher for autocmd
          > file-patterns, please say so in the docs. Ditto for anything else left
          > out like [:blah:]
          >
          > If OTOH the docs are not underselling, then the autocmds in filetype.vim
          > that attempt to use \{n\} and [:blah:] are incorrect and should be replaced.

          On a related note, I found several instances of the "**" pattern in
          runtime/filetype.vim, even though a single "*" would suffice. I guess
          the author was under the (false) impression that a single "*" would only
          match one path component (i.e. up to a slash), and one would need "**"
          for recursion (as is indeed the case for 'path', and 'tags'; too bad
          there are so many conflicting syntaxes).

          ,----[ runtime/filetype.vim ]----
          | au BufNewFile,BufRead *.git/modules/**/COMMIT_EDITMSG setf gitcommit
          | au BufNewFile,BufRead *.git/modules/**/config setf gitconfig
          | au BufNewFile,BufRead *.git/**
          | au BufNewFile,BufRead */usr/**/gnupg/options.skel setf gpg
          | au BufNewFile,BufRead */etc/initng/**/*.i,*.ii setf initng
          `----

          For clarity, these probably should be changed to single "*", as it
          tricks the user (including me, until I tried it out) into believing this
          is a feature. (Though it would probably be nice to have that feature,
          but that would be breaking backward compatibility!)

          How about adding an explicit note to the help:

          #v+
          diff -r d37fb0ea5c7a runtime/doc/autocmd.txt
          --- a/runtime/doc/autocmd.txt Fri Aug 02 17:22:23 2013 +0200
          +++ b/runtime/doc/autocmd.txt Fri Aug 02 18:02:27 2013 +0200
          @@ -952,7 +952,7 @@

          *file-pattern*
          The pattern is interpreted like mostly used in file names:
          - * matches any sequence of characters
          + * matches any sequence of characters (across path separators!)
          ? matches any single character
          \? matches a '?'
          . matches a '.'
          #v-

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

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