On Thu, Sep 1, 2016 at 1:46 AM, Christian Brabandt <[email protected]>
wrote:

> Am 2016-09-01 07:41, schrieb Dominique Pellé:
>
>> Manuel Ortega <[email protected]> wrote:
>>
>> The docs at :h file-pattern don't mention it, but I seem to be able to use
>>> "\=" just fine in autocmd patterns, and it seems to mean what it means
>>> in :h
>>> pattern-overview ("zero or one").
>>>
>>> For instance, `au SomeGroup *.[xgb]z2\= some_command` will fire on files
>>> with any of the following extensions:
>>>
>>>   .xz
>>>   .gz
>>>   .bz2
>>>   .bz
>>>
>>> Maybe this a fluke and it's not supposed to work this way.  But if it is
>>> supposed to work this way it should be in the docs at :h file-pattern
>>>
>>> -Manny
>>>
>>
>> I think that it's not expected and I see it a bug.
>> glob2regpat() gives what look like unexpected
>> results for:
>>
>> :echo glob2regpat('a\=')
>> Actual: ^a\=$
>> Expected: ^a\\=$
>>
>> :echo glob2regpat('a\+')
>> Actual: ^a\+$
>> Expected: ^a\\+$
>>
>> :echo glob2regpat('a\d')
>> Actual: ^a\d$
>> Expected: ^a\\d$
>>
>> And many probably many other cases
>> where \ is special in regexp, but not special
>> in glob special characters.
>>
>
> I believe this is not true. The documentation mentions this:
> ,----[ :h file-pattern ]-
> |                                                       *file-pattern*
> | The pattern is interpreted like mostly used in file names:
> |       *       matches any sequence of characters; Unusual: includes path
> |   [...]
> |       \       special meaning like in a |pattern|
> |   [...]
> `----
>
> So one can expect '\=' to work like a regexp pattern.
>

I think my point stands: the docs need to be expanded (provided this is how
filename-patterns are *supposed* work).  Because the tiny phrase "\
special meaning like in a |pattern|" doesn't seem to even remotely suggest
"a backslash followed by X will have the same meaning that \X does in a
|pattern|".  (Nor does it suggest restricted versions of that, such as "a
backslash followed by a multi-item will have the same meaning that it does
in a |pattern|").  The tiny phrase is *compatible* with the longer one, but
docs are supposed to do more than that.

"\    special meaning like in a pattern" is hopelessly vague.  What special
meaning does "\" have in a pattern?  Just that sometimes characters that
follow it are interepreted non-literally.  So the vague phrase in question
looks rather like it only means "as with patterns, the backslash is a
special character in that sometimes what comes after it is interpreted
non-literally".  That does not enable the user to conclude "\= will work in
a file-pattern just like it does in a regex".

-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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui