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, HTML_MESSAGE,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 21094 invoked from network); 3 Jan 2021 00:54:39 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 3 Jan 2021 00:54:39 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1609635279; b=r/HXvjLQHMko8XLnxZ3bnhRQOZxahnfQaoQ6cggvTeIyxCZErSm1f3jGzMQOlLIDAj0PVGHbeu PpfsIFx3i7PPVQYfuru7RXMTRf245OeYt08YFmgFOhqwyIEgJUnI5pvoEVn75ykbkHZQ1nZEO2 Xhj3czkkdytgcUiHNFg7TQP94HoOry9VB4+39zzs9D0Zp3c2wp6Oajp+SAfU6JSNctbuTu2m2+ hYOMYyorHrP7Nsoduxyjo6l/ZbcLCbiu2BrWqK8XdgBNk0eBgwPIAX+kox8Zti6N3vTQxGkEnT HXceUXIHvCWJTArvvJreqfhmBdsjCWsqTRk0cVVg5NNiFg==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-oi1-f176.google.com) smtp.remote-ip=209.85.167.176; 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=1609635279; bh=hYPP3UuYqtJgaG7idBPM24JnfElZYYRgNDiqs/Hfe/8=; 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=N5lSaVnt0ryCh0iEwjk6CNYpjY/sO+MQqXJzINlpxNwO+KD/EPhJBh79wpiIYYjKXLd+2V+m/W OeukLJb/Wr6S5TLGknCS0oWAvprev8+cJr5NUkxKlTrpwlatqbavQOR+ZuFYYE9WbHSDSbYtcm k1UdE3uV6zoHbArsyp0dobxxKB8YL0gpknOciBTIGgwj3JKBMsr4v/BFiois0ozGhSycsdijVQ GqbcfDg1MC4CQEJXkR0cw6MOn8FzkEWW2+jtyGX+hi7F/tPH8Y95Gd5wztqcIgP4lB97fY/Y+/ BiHn91t4uFzLBvpOG7d1tSRDLsS7h4zaUJ0JLHAZEwgSqg==; 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=CPBa944y8XJxokE3jibQVkZmL0lVQPPssUUrC+5DHbw=; b=HZT2QcqLau3tQZTYBNmWCQGh/9 YWIIMDNc5iBWRTrApVZ6hrRv39vcbPNm0V7OCem6Ynu0VQrjr2PhaUW+Y6fao+zA9ftvPIL9/i41X EixZEvR2ApLxw5JJRJxMVz3Dw854Et/pzN5hn9Ra0ckIebtRyzKTorCzH+b+r+b5LWhLVEmNQ2Iho C7JYff5yBwEaM14So2rYiNq8izsOs+q/OvecEKah3sJK8DqqAqeRXiDS5Kimeb5C6sYPOp7wJZMIt EGgYt0gktWSJwPEnxOZIOWe64vAePwLflxnp4U7EkifWN3sDWdCm87bYI4koO5ikr+WIOWYMnX8ZP PVDDZLZA==; Received: from authenticated user by zero.zsh.org with local id 1kvrfK-0004ro-6w; Sun, 03 Jan 2021 00:54:38 +0000 Authentication-Results: zsh.org; iprev=pass (mail-oi1-f176.google.com) smtp.remote-ip=209.85.167.176; 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-f176.google.com ([209.85.167.176]:38119) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1kvrel-0004Us-I9; Sun, 03 Jan 2021 00:54:04 +0000 Received: by mail-oi1-f176.google.com with SMTP id x13so28043504oic.5 for ; Sat, 02 Jan 2021 16:54:03 -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=CPBa944y8XJxokE3jibQVkZmL0lVQPPssUUrC+5DHbw=; b=gPSJrRnYllLTYnGrVu0bHUFiDeCh8Y4pBZZxcbz4qow56hnwfmKnqWyoWOSa88/rbA MxY8736G8HCqY4XQip/hi33MsUGmbcW9NsY/4OJl7oAc9Wdee9A8iDXEEg3K5igakVSn hXvYPWHQYYfM+HbnNe9mPjSf1Gk/41uoKcpKcK9pvTI7FWYW3Q/L2FmFnRwmGD86WN9x PbUV5I59yDOUsMIQOm+vZ45iBEa7BxqbqIWvBFwZ4MYsU+S1DXlCu2Hb44IH/Ls8+kaJ aaJ8yochN5lrBxY9+N6Xn12uFoFuL/irY2YHgUcIQCoOUe8RoaaEP+67Aduv/THFakt1 wGkQ== 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=CPBa944y8XJxokE3jibQVkZmL0lVQPPssUUrC+5DHbw=; b=qftCalzDVfRZ4ffRj4rletNQN4mTB0cyh3SjK05u5cxi8/GunVRPSTp+RbqhzMseGb TNUNnHZiTDrYFjX8wluZwr6A3maYa9Ujmi6VZ1R1V/NBG1nRzAVFkjSKyDd7w4TyJzre HN1ruCG3hH712CCDv4bk37lxImeZOUdrn060i7JpNe4In0nz0hD4JqO0pV6NfdHZwsjx c+Oix+hph7kmJQQID2v6/a5M1awt5MbR1rUu/0TU3RRMjNJzAZV9YxHqwYrvcvmKbntL 8gotHt65nxdnbrJSqrWFPzRFzQhyAt6NYefJB+MpmAz2J1PMhLIRFWGUqzn1D4WdOQDq VPrQ== X-Gm-Message-State: AOAM531d89mlj7H+JNHa5g9z0g26deK8SmhwaRoQ3IiEnSCGMFj14OC6 KjdITJ59Pl6Y60s54h7mjyUi5ANLxiCdjWRvb2EckQ== X-Google-Smtp-Source: ABdhPJy0tTQNz1cLj0u7PHKb1sPTa4ANWqcT+MoYSkRHAYxVopobutPpTc2D7FDl06igQiiusIyTC7m4rPfKRuj9Z5g= X-Received: by 2002:aca:75cc:: with SMTP id q195mr14540705oic.173.1609635242218; Sat, 02 Jan 2021 16:54:02 -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: Sat, 2 Jan 2021 16:53:51 -0800 Message-ID: Subject: Re: completion within a function To: Felipe Contreras Cc: Zsh Users Content-Type: multipart/alternative; boundary="000000000000d4a4b705b7f46804" X-Seq: 26309 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: --000000000000d4a4b705b7f46804 Content-Type: text/plain; charset="UTF-8" On Sat, Jan 2, 2021 at 4:28 PM Felipe Contreras wrote: > > I'm trying it like this: > > ZDOTDIR=/tmp/empty-home zsh /tmp/complete-bart 'git --' > Don't pass a single, quoted argument; quote each word separately if needed. ZDOTDIR=/tmp/empty-home zsh /tmp/complete-bart git -- The symptom I experienced is that the command never ends, > apparently because the end marker never arrives. > I ran into this a couple of times myself. It seems to have something to do with the definition of "whole string": If a PATTERN is given as well, output is read until the whole string read matches the PATTERN, even in the non-blocking case. If there's anything after the end marker, the "whole string" may not match. I had to try several different variations to find one that gave consistent results. At a guess, you might try: zle_complete () { zle list-choices BUFFER='print -n ""' zle .accept-line } --000000000000d4a4b705b7f46804 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Sat, Jan 2, 2021 at 4:28 PM Felipe Con= treras <felipe.contreras@g= mail.com> wrote:

I'm trying it like this:

=C2=A0 ZDOTDIR=3D/tmp/empty-home zsh /tmp/complete-bart 'git --'

Don't pass a single, quoted argument;= quote each word separately if needed.

ZDOTDIR= =3D/tmp/empty-home zsh /tmp/complete-bart git --

The symptom I experienced is th= at the command never ends,
apparently because the end marker never arrives.

<= /div>
I ran into this a couple of times myself.=C2=A0 It seems to have = something to do with the definition of "whole string":
=
=C2=A0=C2=A0=C2=A0=C2=A0 If a PATTERN is given as well, outp= ut is read until the whole
=C2=A0 =C2=A0 =C2=A0string read matches the P= ATTERN, even in the non-blocking case.

If there= 9;s anything after the end marker, the "whole string" may not mat= ch.=C2=A0 I had to try several different variations to find one that gave c= onsistent results.

At a guess, you might try:

zle_complete () {
zle list-choices
BUFFER=3D'print -n "<END-CHOICES>"&= #39;
zle .accept-line
}
--000000000000d4a4b705b7f46804--