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

[BUG] Any type of file in command position gets misleadingly completed as 'executable file'



% zsh -f
% autoload compinit; compinit
% zstyle '*' format '%d'
% zstyle '*' group-name ''
% mkdir foo
% foo^D
executable file
foo/
% touch bar
% bar^D
executable file
bar

The problem is in _files and it is two-fold:
* _files always adds '*:all-files', which ignores the pattern passed
with the -g flag.
* Even though _files passes its file pattern tags to _next_label, if
_files was passed a tag and/or description, it _always_ prefers these
over the ones returned by _next_label's call to _description.

I propose fixing this as follows:
* _files should not add '*:all-files'. Why would anyone want
_non-matching_ files to be listed?
* The 'globbed-files' tag should be renamed to just 'files' and have a
default description of 'file'. (As an aside, the docs speak of an
'other-files' tag used when zstyle list-directories-first is set, but
this is never actually offered. Let's remove that, too.)
* If _files was passed a tag and/or a description, then these should
replace the 'files' tag (formerly 'globbed-files') and its
description, respectively -- but not the 'directories' tag and/or its
description -- and these should be passed to _next_label.
* For each tag and description that _files passes to _next_label, it
should always prefer the resulting "$expl[@]" over "$opts[@]" when
calling _path_files.

This way:
* Directories will always be listed as directories, unless overridden
through the zstyles supported by _description.
* Any tag and/or description passed to _files will be used to override
only the 'files' tag and its description, and these will be passed to
_description.
* Non-matching files will not be listed.




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