zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-users@zsh.org
Subject: Re: mkdir completion not offering ignored patterns
Date: Sun, 12 Apr 2015 10:18:26 -0700	[thread overview]
Message-ID: <150412101826.ZM21679@torch.brasslantern.com> (raw)
In-Reply-To: <5529A5C2.3090603@gmail.com>

So, disregard my previous message (see below).

On Apr 12,  8:52am, Aleksandrina Nikolova wrote:
} Subject: Re: mkdir completion not offering ignored patterns
}
} On 12/04/15 06:44, Bart Schaefer wrote:
} > autoload +X _mkdir
} > functions[_mkdir]="${functions[_mkdir]:s/_wanted/_tags directories;_requested}"
} 
} Hi and thank you for replying! Your suggested solution changes nothing 
} for me though, not sure why it works for you. If it's of any importance, 
} my zsh version is 5.0.7

Hm.  I must have tweaked something else in the course of trying things
that led to that, because *just* that's not sufficient for me either.

I went back through and discovered that I had not fully cleared some test
styles and still had an ignored-patterns with a different context.

Re-reading your original description more closely:

> I have set the 
> completion system to ignore hidden files and only show them when there 
> are no other options (no other files in the listed directory or I 
> explicitly type . at the beginning).

This actually should be the default behavior with no ignored-patterns set
at all.  So that made me confused about this:

>      zstyle ':completion:*:((*-|)files|(*-|)directories)' ignored-patterns '(*/|).[^/]##'
> 
> Commenting the second one disables hiding of hidden files for all 
> commands and I get those offered by mkdir along with non-hidden ones.

The only thing I can figure out is that you must use the GLOB_DOTS option,
which causes _path_files to generate matches for hidden files.  Perhaps
that is an option for which completion should have a style override.

Once I got that straight I was able to find the real reason for:

> It works perfectly with all 
> commands but mkdir, which simply refuses to offer hidden files, ever.

Which turns out to be that _mkdir calls _message which breaks out of the
loop over _completers in _main_complete, so the _ignored completer in your
style is never reached.

This would not happen if you did not have a "format" style for the context
with tag "descriptions" (which is used as a fallback for tag "messages").

_message really ought to be called only when there is no possibility of
other completions being generated, not merely to suggest what ought to
be typed at that point.  Either that or it needs some option (the inverse
of "_message -e"?) that tells _main_complete to continue even though a
message is pending.

There is at least a workaround:

   zstyle ':completion::*:mkdir::messages' format ''


  reply	other threads:[~2015-04-12 17:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-11  5:44 Aleksandrina Nikolova
2015-04-11 20:44 ` Bart Schaefer
2015-04-11 22:52   ` Aleksandrina Nikolova
2015-04-12 17:18     ` Bart Schaefer [this message]
2015-04-12 22:09       ` Aleksandrina Nikolova

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=150412101826.ZM21679@torch.brasslantern.com \
    --to=schaefer@brasslantern.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).