From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19256 invoked by alias); 21 Sep 2014 21:35:58 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 19130 Received: (qmail 8653 invoked from network); 21 Sep 2014 21:35:55 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, RCVD_NUMERIC_HELO,SPF_HELO_PASS,T_FSL_HELO_BARE_IP_2 autolearn=no version=3.3.2 X-Injected-Via-Gmane: http://gmane.org/ To: zsh-users@zsh.org From: Yuri D'Elia Subject: Re: rsync --progress stops completion Date: Sun, 21 Sep 2014 23:35:37 +0200 Message-ID: References: <2002755.9ryFYYVtTN@note> <5418786F.8030001@thregr.org> <140916175124.ZM5742@torch.brasslantern.com> <54194198.2010607@thregr.org> <140917085133.ZM6725@torch.brasslantern.com> <541AA918.8060503@thregr.org> <140918093602.ZM7963@torch.brasslantern.com> <140918190130.ZM8366@torch.brasslantern.com> <140920112024.ZM29459@torch.brasslantern.com> <140921102006.ZM31805@torch.brasslantern.com> <140921123854.ZM1299@torch.brasslantern.com> <140921140832.ZM1472@torch.brasslantern.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 193.106.183.18 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.0 In-Reply-To: <140921140832.ZM1472@torch.brasslantern.com> On 09/21/2014 11:08 PM, Bart Schaefer wrote: > Declaring "local -a _complete_fallback_precmd" will mean that it goes > away after the autoload of _complete_fallback is finished; so after > that point you're just manipulating an undeclared global. Can you explain a bit in more detail what is the difference between an undeclared global and typeset -g? The manpage wasn't clear to me. > Also I don't think the assignments to/from precmd_functions are going > to do what you want, and there's no reason to do anything if the > context isn't "command" (is there?). Right. > _complete_fallback() > { > [[ $compstate[context] = command && $CURRENT -gt 2 ]] || return 1 > > if [[ -z $_complete_fallback_precmd || $LASTWIDGET != *complete* ]] > then > _complete_fallback_precmd=precmd > add-zsh-hook precmd _complete_fallback_cleanup > compadd -x "Completion failed, press ${${(V)KEYS}:s/\\t/TAB} for fallbacks" > return 0 > fi > > if [[ $LASTWIDGET = *complete* ]] > then > words=("$words[1]" "${(@)words[$CURRENT,-1]}") > CURRENT=2 > compadd -x "fallback: enabled" > _compskip=default > _complete > fi > } Installing the handler immediately on the first go wasn't exactly "user friendly" for me, since I would like a warning before the handler is installed. I would rather wrap _complete as originally suggested to say "completion failed", but the tab thrice(tm) feels good.