zsh-users
 help / color / mirror / code / Atom feed
From: "Jesper Nygårds" <jesper.nygards@gmail.com>
To: Zsh Users <zsh-users@zsh.org>
Subject: Re: Completion for cd
Date: Wed, 15 Mar 2017 08:22:44 +0100	[thread overview]
Message-ID: <CABZhJg98p2bH6yAQ-zw4j2wEY1FVQ-Qr-NKRsJQW2StU_65izA@mail.gmail.com> (raw)
In-Reply-To: <CAH+w=7YmHn1zR-mbkx-SVLyq+UcJhHvhHT3Y3RcFQ2-ELP2i3A@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2105 bytes --]

On Wed, Mar 15, 2017 at 4:56 AM, Bart Schaefer <schaefer@brasslantern.com>
wrote:

> The clue is at the very end of each file:  In the first case [that
> ignores parents as expected], the _complete function generated the
> matches, but in the second case the _approximate function generated
> them.
>
> The path search correctly excludes "zaa" but then _approximate puts it
> back because it is similar enough to the string on the command line.
>

Thanks to your help, I managed to find a working solution, changing the
critical lines to this:
zstyle ':completion:*:complete:cd:*:*' tag-order local-directories
directories -
zstyle ':completion:*:withpath:cd:*:*' tag-order path-directories

In other words,  I have added 'directories' to the first line.

However, I still don't fully understand what is going on. As per your
findings, it's the _approximate function that adds 'zaa'. But that must
mean that none of the previous completers have found any match, doesn't it?
If _complete or  _complete:withpath had found even _one_ match,
_approximate would never have been called, right?

The documentation for the local-directories tag says that it and
path-directories are used if cdpath is set, instead of the 'directories'
tag. I had interpreted this to mean that the 'directories' tag does not
come into play when doing cd completion whenever cdpath is set, as in my
case.

Furthermore, as I read the documentation of tag-order, all tags are in play
after the explicitly mentioned tags, _unless_ the list ends with a hyphen.
However, the tag-order of the second completer, 'withpath', doesn't end
with a hyphen, and I would thus have expected the 'directories' tag to be
tried even though it is not explicitly mentioned.

In short, I would have thought that 'directories' was uninteresting tag
when cdpath was set, and when it actually was in play, I would have thought
it would be tried by the withpath-completer since there is no hyphen at the
end of the tag-order. But obviously I have misunderstood something here,
since it works. I'm just curious to know where the fault in my
understanding is.

  reply	other threads:[~2017-03-15  7:22 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-14 17:38 Jesper Nygårds
2017-03-14 19:07 ` Bart Schaefer
2017-03-14 21:50   ` Jesper Nygårds
2017-03-15  3:56     ` Bart Schaefer
2017-03-15  7:22       ` Jesper Nygårds [this message]
2017-03-15 17:00         ` Bart Schaefer
2017-03-15 20:33           ` Jesper Nygårds
  -- strict thread matches above, loose matches on Subject: below --
2004-03-28 10:42 Thorsten Haude
2004-03-28 12:03 ` Thorsten Kampe
2004-03-28 20:34   ` Thorsten Haude
2004-03-30  1:15     ` Thorsten Kampe
2004-03-31 20:19       ` Thorsten Haude
2004-04-01 18:04         ` Bart Schaefer
2004-04-01 20:44           ` Thorsten Haude
2004-04-02  4:38             ` Bart Schaefer
2004-04-02  6:52               ` Thorsten Haude
2004-04-02 16:11                 ` Bart Schaefer
2004-04-04 14:43                   ` Thorsten Haude
2004-04-04 15:14                     ` Clint Adams
2004-04-04 15:26                       ` Thorsten Haude
2004-04-04 16:39                         ` Clint Adams
2004-04-05  0:04                           ` Bart Schaefer
2004-04-05  3:50                             ` Clint Adams
2004-03-28 19:56 ` Bart Schaefer
2004-03-31 20:22   ` Thorsten Haude
2004-04-01 18:24     ` Bart Schaefer
2004-04-01 20:52       ` Thorsten Haude

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CABZhJg98p2bH6yAQ-zw4j2wEY1FVQ-Qr-NKRsJQW2StU_65izA@mail.gmail.com \
    --to=jesper.nygards@gmail.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).