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

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

Expand Messages
  • 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 1 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.