From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13642 invoked from network); 12 Mar 2000 19:43:52 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 12 Mar 2000 19:43:52 -0000 Received: (qmail 11875 invoked by alias); 12 Mar 2000 19:43:45 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 10095 Received: (qmail 11862 invoked from network); 12 Mar 2000 19:43:44 -0000 From: "Bart Schaefer" Message-Id: <1000312194332.ZM27890@candle.brasslantern.com> Date: Sun, 12 Mar 2000 19:43:32 +0000 In-Reply-To: <20000312130233.A4744@thelonious.new.ox.ac.uk> Comments: In reply to Adam Spiers "Re: _files vs _path_files discussion (old thread)" (Mar 12, 1:02pm) References: <20000311222225.A27795@thelonious.new.ox.ac.uk> <1000312001854.ZM26814@candle.brasslantern.com> <20000312005127.A28688@thelonious.new.ox.ac.uk> <1000312062134.ZM27047@candle.brasslantern.com> <1000312063459.ZM27076@candle.brasslantern.com> <199909170728.JAA01949@beta.informatik.hu-berlin.de> <20000312130233.A4744@thelonious.new.ox.ac.uk> X-Mailer: Z-Mail (5.0.0 30July97) To: Adam Spiers , zsh-workers@sunsite.auc.dk Subject: Re: _files vs _path_files discussion (old thread) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Mar 12, 1:02pm, Adam Spiers wrote: } Subject: Re: _files vs _path_files discussion (old thread) } } # Include non-hidden directories in globbed file completions } compstyle '::complete:*' \ } tag-order 'globbed-files directories' all-files } compstyle '::complete:*:*:directories' file-patterns '*~.*(-/)' } } It's almost perfect ... Have you tried that with, say, `ls' ? I'll bet it ends up completing _only_ directories, because there's no -g option passed to _files for `ls' like there is for `tar'. If you have global directories file-patterns you're going to need them for globbed-files, too ... which then messes up things like `tar' that pass patterns with -g. The globbed-files style replaces the -g option of _files. } The only problem left is in the handling of } hidden directories; ideally, I would want hidden directories only to } appear when the leading `.' is specified manually Hrm, the behavior you want is the behavior I get (for tar), by using: zstyle ':completion::complete:tar::directories' file-patterns '*(-/)' Do you have the GLOB_DOTS option set, by chance? } zstyle ':completion::complete:*:*:directories' \ } file-patterns '*(-/)' } zstyle ':completion::complete:*:*:unhidden-directories' \ } file-patterns '*~.*(-/)' } zstyle ':completion::complete:*' tag-order \ } 'globbed-files unhidden-directories' \ } 'globbed-files directories' \ } all-files } } except that that doesn't work, presumably because you can't just dream } up new tags like that You can dream up new tags, but they'll only be used by functions that know about them -- so you'd have to e.g. modify _files as well. } and maybe you can't even mention tags twice in tag-order. It doesn't make sense to mention tags twice in tag-order, because (in your example) 'globbed-files directories' will only be used when there are no completions for 'globbed-files unhidden-directories', which can't happen if there are any completions for globbed-files alone. Effectively, what you want is to subdivide the 'directories' tag and have it treated like it has it's own internal tag-order. There isn't any way I can think of to express that at the moment. One possibility would be to make file-patterns itself into a hierarchy; that is zstyle :completion::complete:tar::directories \ file-patterns '*(-/)' '.*(-/)' would mean to use '.*(-/)' only if '*(-/)' returned nothing. The current meaning of the above is also expressible by zstyle :completion::complete:tar::directories \ file-patterns '*(-/) .*(-/)' (that is, file-patterns is presently a string, not an array) so we would not be losing any functionality. Then all we need is a magic token in file-patterns to mean "use anything passed to _files with the -g option here" and global file-patterns would become really useful. -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com