Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: _files: -/ causes caller's _alternative to be disregarded



Bart Schaefer wrote on Thu, Sep 01, 2016 at 22:03:55 -0700:
> Good catch, though normally _path_files attempts to fix up glob quals
> to avoid this.  However, doesn't (#q-/)(#q^-/) end up matching nothing?
> (I think that's WHY the aborted portion is inconsequential.)  Is that
> really what is intended here?

I'm not sure what was intended, but I can imagine doing it differently:

Currently, list-dirs-first lists all directories in one group and all
matched files that are not directories in another.  Instead, it could
have three groups: matched directories, matched non-directories,
unmatched non-directories.

For example, «_files -g "M*"» in the zsh tree could show "Misc", either
in its own group [as the only directory matching the pattern], or under
the globbed-files tag alongside plain files matching that pattern.

(For _files -/, this change would simply mean the 'directories' tag
would be empty and the 'globbed-files' tag would have the matches,
instead of the other way around.  But for patterns that match some
directories, the change would be meaningful.)



Messages sorted by: Reverse Date, Date, Thread, Author