zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@zsh.org
Subject: Re: "fake" style requires at least one real match?
Date: Fri, 4 Nov 2016 20:48:01 -0700	[thread overview]
Message-ID: <161104204801.ZM17816@torch.brasslantern.com> (raw)
In-Reply-To: <24199.1478268003@hydra.kiddle.eu>

On Nov 4,  3:00pm, Oliver Kiddle wrote:
} Subject: Re: "fake" style requires at least one real match?
}
} Bart wrote:
} > This is essentially the same Q-and-A as from users/10988 almost exactly
} > ten years ago.  The difference is that the solution in that message no
} > longer works.
} >
} > zstyle -e ':completion::complete:cd:*:named-directories-mine' \
} > ignored-patterns 'reply=("(${(qkj.|.)nameddirs})")'
} 
} In my testing, the (q) flag in there is preventing ignored-patterns
} from working because the | separators get quoted.

That may be true, but I can reproduce with a different pattern that is
neither eval'd nor (q)'d.

With this:

setopt cdablevars
mydirs=( mydir1 mydir2 )
zstyle -e ':completion::complete:cd:*:named-directories-mine' \
    fake 'reply=($mydirs)'
zstyle ':completion::complete:cd:*:named-directories-mine' \ 
    ignored-patterns '?[^y]*'
zstyle ':completion::complete:cd:*' tag-order \
	'named-directories:-mine:extra\ directories'

That should ignore anything that doesn't have a "y" as the second
character, and show only the corresponding subset of nameddirs.

% hash -d move=$PWD
% hash -d home=$HOME
% cd m<TAB>
move    mydir1  mydir2

Why wasn't "move" ignored here?  (I had to have at least one character
of prefix to get it to offer named-directories at all.)

After adding a few more styles to format the listing:

torch% cd m
Completing extra directories
move    mydir1  mydir2

So it's using the named-directories-mine context, but it's including
a word that it shouldn't.

This doesn't always happen.  If I switch to local-directories in the
above, it works as expected.  So maybe there's some interaction with
using the -a or -k options to compadd.


  reply	other threads:[~2016-11-05  3:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-04  0:39 Bart Schaefer
2016-11-04 14:00 ` Oliver Kiddle
2016-11-05  3:48   ` Bart Schaefer [this message]
2016-11-05  5:02     ` Bart Schaefer
2016-11-06  6:42       ` Bart Schaefer
2016-11-06 23:42         ` Bart Schaefer

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=161104204801.ZM17816@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-workers@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).