From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 13818 invoked from network); 5 Jan 2021 19:58:02 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 5 Jan 2021 19:58:02 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1609876682; b=JSkOkR1vOFMvuaITVgy2epAYXZRZruZ5aLmhHol8wbX03ZY+JqqLyvSsNYOt2UbpZYTTSErJSL DvBoUa3K/5vBtA4VtvYlrmx8ZK9hRd1B3r8AhXYefBsw45GRS4FmF1Bef09TvPCU3/woHchTmy rgkUhivE0TwwFN7r7EV17uh7YwCwxUVJqcli4BsMNRl+NKjcCNyd3oZkEw4gBffOguz4QwRFCS 6m3bkHyU4phTFLKX9XsiTXhzCQFVeChaoWc6DEw1ZKC4D6Ed/DcLhjYqgKpoLaY4ElKpCfNpS2 ULWmjlTrs0yBOacu5ymNfIzEWyMjnLn7qsADSEyRN/bS6w==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-oi1-f174.google.com) smtp.remote-ip=209.85.167.174; dkim=pass header.d=brasslantern-com.20150623.gappssmtp.com header.s=20150623 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20200801; t=1609876682; bh=ag5Hv+EGhQb/9j2D8zKXHoq9fngKCxUnCSofLY+cXp0=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:Cc:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:DKIM-Signature:DKIM-Signature; b=wrJteWWO8g0uA7sSilrLU2RDO1fxKJbG3++90gXjd3gOOrqx4ygnNf0pJCRz+LDYpVdI0HdzQ/ 7JKGmhZoNb222P37U1c3Fm5dkilFISfKLxz9n0T/1eLXkSJ4VkSBZyyGkE3N4lBmD7OcujlQW2 X9dVf7QxvyZaKwcol4G9qOS8/I/cporFNjMhVBv0gkDFjk2fmrAoJPr4o+vXJfBGv5t1G/weZO HoEBVHL8yygIW2p2rN1msi0UBaTk0ct330ikJk4dOWqomaYyn6pqRmhXHnpEZ6WEUqnjZSQerP /xb2BgiaEq/4OE4TIJwMCHfE+7y8CCiCTuEuaZuANQGnMA==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20200801; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Type:Cc:To:Subject:Message-ID :Date:From:In-Reply-To:References:MIME-Version:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=4sdgXhmoBqIo7EIHIgCXKzdW0nlI9l1iC21GaJpnVzc=; b=N/RpoynhSCgBNYC5UhvuRykiQL AEzw8OuyfuP7S8lLl3X8grNRRfqoytPgAERaw+C2rMV59wiBCZXX3jf93icFWlFhMFvYNUOVBdsDR OQPpMFZ34zwVm+wJHFFGTJdn+QsQLkLHn8yeGk4v7yDC+RXGQWdAQmznKJM+TjQ7bf46igxujj1Bh u4/fGlrxQ51sd32SlhSBRuCfV/Y6im3dSBe9phYgGJq9voeR34A72fAOFbYdt88RE+F06CB5CexsC YLomqSb855MVK/at59Wxw5veOnJil2TjCgh5P2KzaTeSEfcbfUBfbOHV+H73JmtNa7b9LlbORdwzc iz1bhzEw==; Received: from authenticated user by zero.zsh.org with local id 1kwsSs-000FHo-Er; Tue, 05 Jan 2021 19:57:58 +0000 Authentication-Results: zsh.org; iprev=pass (mail-oi1-f174.google.com) smtp.remote-ip=209.85.167.174; dkim=pass header.d=brasslantern-com.20150623.gappssmtp.com header.s=20150623 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none Received: from mail-oi1-f174.google.com ([209.85.167.174]:40890) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1kwsSN-000Ev9-Ep; Tue, 05 Jan 2021 19:57:29 +0000 Received: by mail-oi1-f174.google.com with SMTP id p5so861444oif.7 for ; Tue, 05 Jan 2021 11:57:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=4sdgXhmoBqIo7EIHIgCXKzdW0nlI9l1iC21GaJpnVzc=; b=CTgL+uHRlIZpdSoA+jTjBCAV7ugErWFZzRjiw1cIkoHF2KYYerllZMFJv8khHySEGV Z+UI1iEeDJsuXilYixqi4ve3apRP/p5oUN05IiuXDH4XBIZyZkkpiN5uvZ7noti+yGJO 43YVpvJpGJeLHS+i+C1/gczPWpay0cjq0LkDxWF+rRY1FTt6Kk2vKpL/HflyX9jTnvK4 ICy2Jj9xExOYnVAR5LV3wXY/CNaptx5/27BkwVdaZG1A9vjDmrWyQ2g4v4cOaNOR0pfs N43S6BWfPLtFvoJ2uja1fn57O2f4IxUD+8qKaokXT5YoxtGxnXDwDJAMDBdrSh7tgOLv 2xMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=4sdgXhmoBqIo7EIHIgCXKzdW0nlI9l1iC21GaJpnVzc=; b=cO/q/ZeEyPxZivrv1ADVRaAtCkqCE6+YHd+YiMVxfbbPKKncvridGgBSQK7UI1RHSh 1Hbn2L0uh+xOtpC762+k7Bgtlfo5314G9enPf5Unb/dfcbCElV9VW57Q0hfiFKSsEqqE 6PLUvYbpj5GwaJ1vnIGvYdcVeVCnHn+AjZy1q9db8yiEyqSMzzud5YqbUVHq4wJ+YGJm nAqrqes14CnwpkR+x7LTCP4xNav6N0MQTqzsG8iyLYYe1XwiJtW/8FurAlttOJPJtYnX vKCb+vINYSQCCAEhVHeakiXiZFqHUBiA96ew3QDF2RaonTcD8TzYJ9m75d7T+CH28CAl Qqrw== X-Gm-Message-State: AOAM531srGwtWWGDx9ur/ROkHH9CpJsfYqa/1reZ4jTqJgJKWEGO4Fvh JYJp3MjtvQVsbdy5CmRDYzx2Uz3lHcX5mSzqSUTd/g== X-Google-Smtp-Source: ABdhPJy/xMBHcy5+NcSDLuxLwnw5JTdIarlKkp0rAIAZfVUKA3wijKy9E5n+bgJieGSCmdYoiCQiXTU8BbzmW3uoecU= X-Received: by 2002:aca:6089:: with SMTP id u131mr931080oib.84.1609876645484; Tue, 05 Jan 2021 11:57:25 -0800 (PST) MIME-Version: 1.0 References: <819ec6fe-5af2-2e97-c5bb-f434b1de86d7@eastlink.ca> <520ce98a-4394-726d-3d12-8ef414e881c9@eastlink.ca> In-Reply-To: From: Bart Schaefer Date: Tue, 5 Jan 2021 11:57:13 -0800 Message-ID: Subject: Re: completion within a function To: Felipe Contreras Cc: Zsh Users Content-Type: text/plain; charset="UTF-8" X-Seq: 26334 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: Archived-At: On Sun, Jan 3, 2021 at 3:16 PM Felipe Contreras wrote: > > [...] your version seems to take longer to load, slowing the tests. I don't know what your version is loading or whether a .zcompdump file might be getting used to speed that part up. When I try it (with the zsh-dist-provided git completions) it spends more of its time populating git data than anything else. > [...] it still doesn't work correctly: I can't pass empty arguments > in the middle of a command-line. What does an empty argument in the middle of the line mean to the completion result? Which word are you trying to complete? I thought you were passing a single string as the only argument to my "complete" function? If that's true, how is the empty argument represented in that string? > Also, I don't understand why is there an argv there: > > vared -M __complete -i __init_complete ${${argv:+argv}:-reply} > (( ARGC )) || print -nrl -- "~~~${(@)reply}~~~" > > Isn't "reply" always used? And ARGC is always 0? The ARGC/argv stuff is there so that you can call run-complete directly: % run-complete "git checkout -- " which only works from an interactive command line, and just prints the completion without forking off a zpty. Called as the zpty command from complete, yes, ARGC is always zero and reply is used.