From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7620 invoked by alias); 6 Jan 2011 16:41:36 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 28579 Received: (qmail 7360 invoked from network); 6 Jan 2011 16:41:34 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at closedmail.com does not designate permitted sender hosts) From: Bart Schaefer Message-id: <110106084111.ZM20766@torch.brasslantern.com> Date: Thu, 06 Jan 2011 08:41:09 -0800 In-reply-to: Comments: In reply to Mikael Magnusson "matcher-list doesn't work with some completers?" (Jan 6, 11:14am) References: X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh workers Subject: Re: matcher-list doesn't work with some completers? MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Jan 6, 11:14am, Mikael Magnusson wrote: } Subject: matcher-list doesn't work with some completers? } } mkdir 'a directory' } zsh -f } autoload -Uz compinit; compinit -D } zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' +'l:|=* r:|=*' } ls dir #works } du dir #nothing This is a bug in _du, it's returning a 0 status without ever adding any matches, which causes _dispatch in turn to report success to _complete which then skips running the matcher-list. This in turn is because _du checks for a state transition to handle the --time and --time-style options, and that case statement masks the return value from _arguments. I don't know for sure whether the fix is to save the return value from _arguments and then return that in a (*) branch of the case statement, or to return immediately if _arguments fails and not bother checking the state transition at all. _mkdir does the former, so ... Someone with copious free time should do a sweep of the completion functions and make sure they're correctly propagating return values from _arguments, _wanted, etc. Index: Completion/Unix/Command/_du =================================================================== RCS file: /extra/cvsroot/zsh/zsh-4.0/Completion/Unix/Command/_du,v retrieving revision 1.4 diff -c -r1.4 _du --- _du 21 Dec 2010 16:41:15 -0000 1.4 +++ _du 6 Jan 2011 16:38:35 -0000 @@ -1,6 +1,8 @@ #compdef du if _pick_variant gnu=Free\ Soft unix --version /dummy/no-such-file; then + local ret=1 + _arguments -s \ '(-a --all -s --summarize)'{-a,--all}'[write counts for all files]' \ '--apparent-size[print apparent sizes rather than disc usage]' \ @@ -27,22 +29,24 @@ '--time=-[show time of last modification of any file in the directory]:property:->time' \ '(* -)--help[display help information]' \ '(* -)--version[display version information]' \ - '*:file:_files' + '*:file:_files' && ret=0 case $state in (time) local -a property property=(atime access use ctime status) - _wanted property expl property compadd -a property + _wanted property expl property compadd -a property && ret=0 ;; (timestyle) local -a style desc style=(full-iso long-iso iso +) desc=('full-iso' 'long-iso' 'iso' '+FORMAT like `date'\''') - _wanted -V style expl style compadd -d desc -a style + _wanted -V style expl style compadd -d desc -a style && ret=0 ;; esac + return ret + else # based on $OSTYPE = solaris2.8 local xdev='[skip directories on different filesystems]' --