From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25966 invoked from network); 18 Dec 2003 09:43:24 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 18 Dec 2003 09:43:24 -0000 Received: (qmail 10283 invoked by alias); 18 Dec 2003 09:43:18 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 19309 Received: (qmail 10226 invoked from network); 18 Dec 2003 09:43:17 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 18 Dec 2003 09:43:17 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [193.109.254.211] by sunsite.dk (MessageWall 1.0.8) with SMTP; 18 Dec 2003 9:43:17 -0000 X-VirusChecked: Checked X-Env-Sender: okiddle@yahoo.co.uk X-Msg-Ref: server-20.tower-36.messagelabs.com!1071740596!2579958 X-StarScan-Version: 5.1.15; banners=-,-,- Received: (qmail 4762 invoked from network); 18 Dec 2003 09:43:16 -0000 Received: from iris.logica.co.uk (158.234.9.163) by server-20.tower-36.messagelabs.com with SMTP; 18 Dec 2003 09:43:16 -0000 Received: from gmcs3.local ([158.234.142.61]) by iris.logica.co.uk (8.12.3/8.12.3/Debian -4) with ESMTP id hBI9hFuB027041 for ; Thu, 18 Dec 2003 09:43:15 GMT Received: from gmcs3.local (localhost [127.0.0.1]) by gmcs3.local (8.11.6/8.11.6/SuSE Linux 0.5) with ESMTP id hBI9lTA07921 for ; Thu, 18 Dec 2003 10:47:29 +0100 X-VirusChecked: Checked X-StarScan-Version: 5.1.13; banners=.,-,- In-reply-to: <1031217183837.ZM16074@candle.brasslantern.com> From: Oliver Kiddle References: <20031213154651.GR18859@strindberg.dsv.su.se> <1031213191918.ZM5325@candle.brasslantern.com> <20031213233905.GW18859@strindberg.dsv.su.se> <3213.1071488991@gmcs3.local> <1031215170258.ZM12804@candle.brasslantern.com> <1772.1071676636@gmcs3.local> <1031217183837.ZM16074@candle.brasslantern.com> To: zsh-workers@sunsite.dk Subject: Re: Completion in pwd before subdirecories Date: Thu, 18 Dec 2003 10:47:29 +0100 Message-ID: <7919.1071740849@gmcs3.local> Bart wrote: > > Hrm. I thought I'd found it the other day but now I can't any more. I > believe it _used_ to be there (or in _path_files) because Sven grumbled > at least once about how difficult it was to write. But maybe something > changed so that it was possible for it to be taken out again. Doing a bit of a search in the archives, the nearest I can find is 11635. That deals with _path_files and glob qualifiers on the command-line when doing pattern based matching. Is that perhaps what you were thinking of? > In fact, that may have been what led to the introduction of (#q) in the > first place. It was a comment by me in 16447 that led to (#q). I was suggesting using things like -g '*.png(.)' back then so must have been thinking clearer than earlier this week. I managed to forget why I had wanted to add qualifiers in series but it might have been for the file-patterns style. > } So either we need to add #q when using glob qualifiers or _files should > } attempt to merge trailing glob qualifiers. I favour the latter. > > Good luck, then. > The documentation is fairly clear that a glob qualifier is a trailing set of parentheses containing no `|', `(' (or `~' if it is special). Not sure I understand what the "if it is special" means - anyone? The _path_files stuff from 11635 believes the documentation, using the pattern \([^\|\~]##\) So the patch below (to _files) uses that pattern to find a glob qualifier in the argument to the -g option and sticks a #q in. Unfortunately, the documentation doesn't give the whole story: *(e:'[[ -d ~/$REPLY || -d ../$REPLY ]]':) and *(e:'(( 1 ))':) both work. Seems to me that anything is valid just so long as it is quoted. *(e'|'true'|') works while *(e|true|) doesn't. So how do I match a quoted string with a glob? Does anyone have something already? Is it even possible given nested quoting? The only thing I can think of would be to dig into the C and add a globbing flag which matches quoted characters, unquoting them before matching so I could do something like: \(([^\|\~]|(#U)*(#u))##\) I'm inclined to apply this patch as it is for now. I can't see any existing uses of qualifiers with quotes and we could always add `#q' manually for the odd case and exclude quotes along with |, ( and ~ in _files. My tip for the day for taking advantage of this change is this style: zstyle ':completion:*:approximate*:*' file-patterns \ '%p(D):globbed-files *(D-/):directories' '*(D):all-files' With that, _approximate can correct `,zshrc' to `.zshrc'. Now for the dull job of adding lots of (-.) qualifiers. Oliver PS. Hope you get well soon Bart. Index: Completion/Unix/Type/_files =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/Unix/Type/_files,v retrieving revision 1.8 diff -u -r1.8 _files --- Completion/Unix/Type/_files 4 Jul 2003 18:19:20 -0000 1.8 +++ Completion/Unix/Type/_files 18 Dec 2003 09:24:24 -0000 @@ -11,6 +11,10 @@ glob="${${${${(@M)tmp:#-g*}#-g}##[[:blank:]]#}%%[[:blank:]]#}" [[ "$glob" = *[^\\][[:blank:]]* ]] && glob="{${glob//(#b)([^\\])[[:blank:]]##/${match[1]},}}" + + # add `#q' to the beginning of any glob qualifier if not there already + [[ "$glob" = (#b)(*\()([^\|\~]##\)) && $match[2] != \#q* ]] && + glob="${match[1]}#q${match[2]}" fi tmp=$opts[(I)-F] if (( tmp )); then