From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 285 invoked from network); 7 Nov 2008 12:39:18 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 7 Nov 2008 12:39:18 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 32980 invoked from network); 7 Nov 2008 12:39:10 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 7 Nov 2008 12:39:10 -0000 Received: (qmail 18228 invoked by alias); 7 Nov 2008 12:39:02 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 26017 Received: (qmail 18211 invoked from network); 7 Nov 2008 12:39:02 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 7 Nov 2008 12:39:02 -0000 Received: from smtp140.mail.ukl.yahoo.com (smtp140.mail.ukl.yahoo.com [77.238.184.71]) by bifrost.dotsrc.org (Postfix) with SMTP id 333AD80308BE for ; Fri, 7 Nov 2008 13:38:59 +0100 (CET) Received: (qmail 38436 invoked from network); 7 Nov 2008 12:38:58 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.co.uk; h=Received:X-YMail-OSG:X-Yahoo-Newman-Property:Received:In-reply-to:From:References:To:Subject:Date:Message-ID; b=kmjmXXD14uwccE6w/JDKhgu3lBkU1+/5RTwY633N0zPFpEVkxyM+WTWWHU0Osn2KCvlaRCK2MATt4ZcXCswC7B16+niHadnTEjFlRu3PvqrRottyY4rhASAKdl0wJp/yRayVEcn/3HyR8sfaei4Q0+5pbaaN+q4at03mVu7ivS8= ; Received: from unknown (HELO thecus) (okiddle@89.60.221.193 with plain) by smtp140.mail.ukl.yahoo.com with SMTP; 7 Nov 2008 12:38:58 -0000 X-YMail-OSG: 2NRyKUIVM1lK_b5D2F04mzIQDHnG_5eM8HgqVj2JWfiRcQeAQvu56t6qOklhHSIJ.US5KugXDUk1POpRaZxQ6ad6VJTR9yGcLyEqVL64ilIQHrTRFSAUcA8R56HBGa1LumhzmpuJHXyvMHYlkjYIk78CD7Irjyob3OssqEk- X-Yahoo-Newman-Property: ymail-3 Received: from localhost ([127.0.0.1] helo=thecus) by thecus with esmtp (Exim 4.63) (envelope-from ) id 1KyQc4-0003E5-UP for zsh-workers@sunsite.dk; Fri, 07 Nov 2008 13:38:57 +0100 In-reply-to: <11164.1203725067@pws-pc> From: Oliver Kiddle References: <11164.1203725067@pws-pc> To: zsh-workers@sunsite.dk (Zsh hackers list) Subject: Re: PATCH: completion of glob qualifiers Date: Fri, 07 Nov 2008 13:38:56 +0100 Message-ID: <12404.1226061536@thecus> X-Virus-Scanned: ClamAV 0.92.1/8586/Fri Nov 7 05:55:22 2008 on bifrost X-Virus-Status: Clean On 23 Feb, Peter Stephenson wrote: > This is mostly useful as a memory jogger rather than actually to save > you typing a single character. However, I've added a pretty useless > function to save you typing a delimiter character. (The alternative > was simply to print a message saying "delimiter", which was > really low tech.) > > It works OK so far but it does raise various issues about related things > that might be got to work better. You might run across those. I've only just noticed this change back in message 24585. Is there any reason why globbing flags were not completed. This patch adds them. Note that inside [[ ... ]] conditions, a bracket that is not preceded by some other character is assumed to be used for grouping of conditions so this won't work with glob flags at the beginning of a pattern. One problem possibly due to your original patch is the following; : */( results in the /( being removed. I haven't worked out why but this doesn't occur with the old zsh that comes with Debian stable. I've also changed _globquals to use _message -e instead of plain _message. This applies a tag and allows certain styles (such as fake) to be used. Oliver Index: Completion/Unix/Type/_path_files =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/Unix/Type/_path_files,v retrieving revision 1.39 diff -u -r1.39 _path_files --- Completion/Unix/Type/_path_files 29 Oct 2008 21:59:32 -0000 1.39 +++ Completion/Unix/Type/_path_files 7 Nov 2008 12:34:34 -0000 @@ -394,7 +394,11 @@ "$tpre/$tsuf" = (#b)((*[^\\]|)(\\\\)#"(#q")([^\)]#) \ ) && -z $compstate[quote] ]]; then compset -p ${#match[1]} - _globquals + if [[ -o extendedglob ]] && compset -P '\#'; then + _globflags + else + _globquals + fi elif [[ "$tpre$tsuf" = */* ]]; then compfiles -P$cfopt tmp1 accex "$skipped" "$_matcher $matcher[2]" "$sdirs" fake elif [[ "$sopt" = *[/f]* ]]; then Index: Completion/Zsh/Type/.distfiles =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/Zsh/Type/.distfiles,v retrieving revision 1.3 diff -u -r1.3 .distfiles --- Completion/Zsh/Type/.distfiles 15 Mar 2008 23:21:02 -0000 1.3 +++ Completion/Zsh/Type/.distfiles 7 Nov 2008 12:34:34 -0000 @@ -7,6 +7,7 @@ _directory_stack _file_descriptors _functions +_globflags _globqual_delims _globquals _history_modifiers Index: Completion/Zsh/Type/_globflags =================================================================== RCS file: Completion/Zsh/Type/_globflags diff -N Completion/Zsh/Type/_globflags --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ Completion/Zsh/Type/_globflags 7 Nov 2008 12:34:34 -0000 @@ -0,0 +1,33 @@ +local ret=1 +local -a flags + +if compset -P a; then + _message -e numbers 'errors' + return +elif compset -P q; then + _globquals + return +fi + +flags=( + 'i:case insensitive' + 'l:lower case characters match uppercase' + 'I:case sensitive matching' + 's:match start of string' + 'e:match end of string' +) +[[ $compstate[context] = condition ]] && flags+=( + 'b:activate backreferences' + 'B:deactivate backreferences' + 'm:set reference to entire matched data' + 'M:deactivate m flag' +) + +_describe -t globflags "glob flag" flags -Q -S ')' && ret=0 +flags=( + 'a:approximate matching' + 'q:introduce glob qualifier' +) +_describe -t globflags "glob flag" flags -Q -S '' && ret=0 + +return ret Index: Completion/Zsh/Type/_globquals =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/Zsh/Type/_globquals,v retrieving revision 1.2 diff -u -r1.2 _globquals --- Completion/Zsh/Type/_globquals 23 Feb 2008 18:34:02 -0000 1.2 +++ Completion/Zsh/Type/_globquals 7 Nov 2008 12:34:34 -0000 @@ -25,7 +25,7 @@ return elif ! _globqual_delims; then # still completing mode spec - _message "mode spec" + _message -e modes "mode spec" return fi fi @@ -57,7 +57,7 @@ (d) # complete/skip device if ! compset -p '[[:digit:]]##'; then - _message "device ID" + _message -e device-ids "device ID" return fi ;; @@ -65,7 +65,7 @@ (l) # complete/skip link count if ! compset -P '([-+]|)[[:digit:]]##'; then - _message "link count" + _message -e numbers "link count" return fi ;;