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

Re: PATCH: _rpm tweaks (_files vs _path_files discussion)



Adam Spiers wrote:
> Now people may disagree with this, but I would have thought that in
> many completion scenarios, _path_files -/ -g <glob> is more
> appropriate than _files -g <glob>.  For example, when completing tar
> archives, if there are none in directory foo, and you type 

It is a bit of a problem.  The real trouble is _files is too generic; if it
fails, it doesn't know what it should try next.  Often, as in this case, it
should try directories, but sometimes, for example looking for tar archives
with a non-standard suffix, it's useful to get everything.  This depends
on where you are completing.

A second issue is whether, if you find target files in the current
directory, you might still want to complete directories.  This is also hard
to generalise on, since if you are completing a common enough file type you
might very well want to be offered directories straight away, while if
there aren't many of that type they may just get in the way.  But probably
we need to be more consistent, rather than depending on who happened to
write the completion file.

It's not a perfect solution, but we could have an argument to _files saying
search only for directories if nothing found, not everything else, and a
completion key saying whether, if that flag is passed, you want directories
included in the list with the other files.  For example,
_files -g <glob> + -/ (hey, this gives me the idea for another type of
completion interface :-/), and the configuration option
path_merge_alternatives, or something shorter.

-- 
Peter Stephenson <pws@xxxxxxxxxxxxxxxxx>       Tel: +39 050 844536
WWW:  http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy



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