From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6927 invoked from network); 12 Mar 2000 06:21:57 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 12 Mar 2000 06:21:57 -0000 Received: (qmail 1929 invoked by alias); 12 Mar 2000 06:21:51 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 10084 Received: (qmail 1904 invoked from network); 12 Mar 2000 06:21:48 -0000 From: "Bart Schaefer" Message-Id: <1000312062134.ZM27047@candle.brasslantern.com> Date: Sun, 12 Mar 2000 06:21:34 +0000 In-Reply-To: <20000312005127.A28688@thelonious.new.ox.ac.uk> Comments: In reply to Adam Spiers "Re: _files vs _path_files discussion (old thread)" (Mar 12, 12:51am) References: <199909170728.JAA01949@beta.informatik.hu-berlin.de> <20000311222225.A27795@thelonious.new.ox.ac.uk> <1000312001854.ZM26814@candle.brasslantern.com> <20000312005127.A28688@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, 12:51am, Adam Spiers wrote: } Subject: Re: _files vs _path_files discussion (old thread) } } Bart Schaefer (schaefer@candle.brasslantern.com) wrote: } > zstyle ':completion::complete:tar::' \ } > tag-order 'globbed-files directories' all-files } } That's exactly what I'd tried, with once difference; as I mentioned, I } want this behaviour everywhere, not just for tar, so I'd tried: } } zstyle ':completion::complete:*' \ } tag-order 'globbed-files directories' all-files } } However, neither your version nor mine seem to work. Maybe I'm just } missing a bugfix because I'm behind on patches. No; Sven explained this back in 9858, and asked whether it should be changed [*]. It's not sufficient to give the tag-order style, you also have to specify the file-patterns for each of the tags that you actually want to generate completions. So you also need e.g.: zstyle ':completion::complete:tar::directories' file-patterns '*(-/)' You can of course replace :tar:: there with :*:*: to make all commands that use _files complete directories; but as Sven mentions in 9864, you may not want that, which is why the file-patterns are required to be given in the first place. _tar already supplies a file pattern for globbed-files by passing a -g option to _files, so (unlike many other commands) you _don't_ need to specify the file-patterns for *:tar::globbed-files. You _do_ need to specify file-patterns for all-files if you want those included. [*] Sven's suggested change was: } ... should we make the directories tag with its usual pattern be } tried automatically if the user explicitly sets the file-patterns tag } for globbed-files? Or should we do that only if the directories tag, } file-patterns style is given, but allow an empty value to stand for } `the normal pattern'? I meant to reply to that and hadn't got around to it yet. My short answer is that I don't think there's any good solution. The tag-order style is going to be confusing no matter what we do; people are always going to wonder why, when they can see "directories" in the tag-order style, they still don't get any directories completed. It's a case of intuition being at odds with logical semantics, and I can't think of any way to make the intuition work without ruining the logic. Automatically adding directories when globbed-files is given only makes things cloudier; allowing an empty pattern to stand for '*(-/)' doesn't alleviate the need to provide the directories style, which is the real basis of the confusion. So I think I'd leave the code as is, and put some kind of blaring all-caps text in the tag-order documentation: NAMING A TAG IN TAG-ORDER DOES NOT CAUSE COMPLETIONS FOR THAT TAG TO BE GENERATED; RATHER, IT SORTS THE COMPLETIONS AFTER THEY ARE GENERATED. -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com