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

Re: <Tab> completion does not insert a slash

On Wed, Aug 11, 2021 at 1:23 PM Peter Slížik <peter.slizik@xxxxxxxxx> wrote:
> сре, 11. авг 2021. у 22:03 Peter Slížik <peter.slizik@xxxxxxxxx> је написао/ла:
>> Sorry for the late reply, I tried both versions (with and without parentheses).

I don't know what "with and without parentheses" means here.

>> % cd sr<ctrl+x h>
>> tags in context :completion::complete:cd::
>> local-directories named-directories      (_cd)
>> users named-directories directory-stack  (_tilde _cd)
>> users                                    (_users _tilde _cd)
>> % cd src/py<ctrl+x h>
>> tags in context :completion::complete:cd::
>> named-directories  (_cd)
>> local-directories  (_cd)
>> % cd src/python/<ctrl+x h>
>> (no results)

Are there any subdirectories inside src/python/ ?  The only case in
which I can get this to reproduce is when there's nothing more to

If there are subdirectories, a possibility is that the permissions on
either the python directory or the subdirectories are preventing
further names from being found.

This is the case where you switch to running <ctrl+x ?> and look at
the trace file.

>> Do you think that there is anything suspicious? Personally I wonder why there are duplicated entries in the first case and why are the tags listed in a reversed order in the second case.

The output of c-x h is not sorted by the tag-order style, it's in the
order that the tags are populated by the completion function.  _cd
happens to check for named directories first.  In an actual completion
pass, filtering the display according to tag-order happens later,
after all the possible tags have been populated.

> OK, more clarification. I've used "zstyle ':completion:*:*:*:*:descriptions'".
> Now it seems that with the second completed path, the completion engine cannot decide between these two:
> % cd src/python<Tab>
> -- directory after cdablevar --
> -- local directory --

I don't have your set of "hash -d" entries nor your file structure,
but with the closest guess I can make using the zsh source tree, I get
that result only when there are no subdirectories left to complete.
What does (execution of, not completion of)
  ls -ld ~src/python/*(/)
show you at that point?

> Frankly, I still don't understand what the problem is, because I'm inside a dir pointed to by a named directory (src/ in this case) and both "directory after cdablevar" and "local directory" are the same directory anyway.

Whether they're the same directory doesn't actually matter; the tags
have caused them to be placed in separate groups, so as far as
completion is concerned they are different alternatives.  The
"directory after cdablevar" branch has gone down the full path
$src/python (and then hidden a prefix) whereas the local directory
branch has used the relative path src/python and completion is only
looking for unique strings, not filesystem targets.  The filesystem is
only examined to generate the strings that are compared.

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