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,T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 2641 invoked from network); 29 Jun 2022 03:50:16 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 29 Jun 2022 03:50:16 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1656474616; b=E6VXHdTuV90b8KjhqxoRBa1Y78P/tr2Lk63Z2Kww3m3BVU1YXMaxGPNbG1ezUGCt69cIvXvF21 cLU5LhO2URASnz7c+ws0cK9dRg71v4CgppTh1BgdkYPmUXjwj1xFBn/3puLk3oa510z5wK0QCv Jx0rcR1c/xUMKwDMxGr7xIhxD9+IL0PLIdDDZELDZyCmVjvtMhfsSAzamObJslInHc2w0kUvWj E5xXRxnJMqCSeLg4bFDOC+y/yvjKEA5Qbm5eCCnd+xYDIA9A1ftw5sLpGMu+cdCqsdJKQTx2RE YSIsIozVzzihxrplU2nyixAkPqMrIi7Im5N9C0NL1ejqcg==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-ed1-f52.google.com) smtp.remote-ip=209.85.208.52; dkim=pass header.d=brasslantern-com.20210112.gappssmtp.com header.s=20210112 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-20210803; t=1656474616; bh=OpILBSnrgUvg1Utb6uoTDkp+F7UG0/Nm6nMmkEGCF7w=; 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=Ari9jshScq7q2Yb0eHR8udD7/TUld5sBh7PEB97ygu0YE/kTsSrhGpChx2iAACf0vqMsFiyIAW Xpb6C0KLw39z7HPnZQMPSIOAszMK6R9LqdkpFdLhWtteIWYLUj8gq5MDjPn0XhzxXjVw0uP49R EGBFcQXvNZSwOOxXeRyQ44AVWdPNb9IJbSpN9sm7VFR4ggwwgAMOoEv1/QmKAo8MCgkhMPg8u/ +Hn8+RbmRXvhfYbZpDxM9R8RKaZwfxc9rJUaBPg27T3r08FeV2Foidgn/+PDRHNs0u15pftctF anYpMpvGsKlphbpjlsSrXrJVzMIdBFPQ+4HNLaaT6lWY/A==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; 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=h3cQRbm9cZrU0baAWltLUTlVxD0spl1aNqHWEjJTsO4=; b=Qt1pSa58XR+EZZ2oei501NeTZE 07Crs3+OsIwJLbwt3hyPgwALv27kgC4YPZdBHoZjyqbx6A4hMN/7N+4P7jnc0aSbi5vx968jmIjnI YD8EJ52Ygd/V4LA2mghwBpguduY1ufKFF5kxehlP4qVrUb56VfBndRYb7gAQBQoSUMR+9KYL+Gw5k mkBvHj5gCOCrRAV1FOW68RHXJGGohkVLSk9wRnEWW+9GhPtBrSYjqTXLjWgsxO2Hw2sngSpFUf+Eb CMZFka14XUtdBalS/lqjq0q826KYWyBjtVH77u2EvmYg33jP3/+unAxSQ21E5sjLaGU2etLxXyD8l 3fxIwGzA==; Received: from authenticated user by zero.zsh.org with local id 1o6OiU-000Ekv-EH; Wed, 29 Jun 2022 03:50:14 +0000 Authentication-Results: zsh.org; iprev=pass (mail-ed1-f52.google.com) smtp.remote-ip=209.85.208.52; dkim=pass header.d=brasslantern-com.20210112.gappssmtp.com header.s=20210112 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none Received: from mail-ed1-f52.google.com ([209.85.208.52]:38791) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1o6Oi9-000EQO-0N; Wed, 29 Jun 2022 03:49:54 +0000 Received: by mail-ed1-f52.google.com with SMTP id fd6so20394612edb.5 for ; Tue, 28 Jun 2022 20:49:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=h3cQRbm9cZrU0baAWltLUTlVxD0spl1aNqHWEjJTsO4=; b=mZpyNtA6yq8UMP0+fn8PPJ5xZwyG1As9AZdR5mav7pp2zAM8Bzk84/FNb/FvjS5VcJ HE+6xJ7rETr1e1u/M5X7rvI3HCFP1mI2/tpI79sku6gerKf47VjG5dnu3I9Soef5PS6W zwjpX56FmZ6aaf+zXNpYtlAQ5DpO4cOKsrEN56vy6xu2y7gE/kV50iAJdHxayXnnh1v3 Md3GL/nYINYWvccqooLY23VlJJAzBLWo6Oba7oRg4u31lQ6ceoaFIDVwHx9a/bB2MFfu 3wiBRcAed1j+eCD47qP4uvAwOJ+GmIDWIDf/DdrZbSTEz0szhz4xrs3gQ7/orMhlK79U oAnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=h3cQRbm9cZrU0baAWltLUTlVxD0spl1aNqHWEjJTsO4=; b=sII8W0CTuC4U9iJS4VkCY6GZR34dRQ+uYZrbTKCvTCs8dLTytGNlrwCSUmsSWcJhAU YviFmr9y28g4UzapMQxEmpqAUAVH4rxUw7hSjEWrWuMvQwSPRUSSq/90Sj8tkPpug4Rm 0RDoletc7/U3Nl9X3B5zuD8q+vha+66d1wA2SCPqT81UN3IqXrfoCeYalAQUhR6H+1AB qf1xhBpzVqcuDxKqzSK47Rw3UIAYd2D0EQ6eEQFUPYKfmoVdWxxrVBwZEKQfdTBKqlTF /mJlLc1L0FvwWvvdG08wRPJqCr3Ry9VBDCu9i7jbOPV7/iBe/jJ0Z91cnYr52gVCD3ZU lCaw== X-Gm-Message-State: AJIora9cHa3rl4iJuPxwheDnVd9jIawC+qkJpdLSw1vD4pJZOQ2ER3Y1 2J3imWhnrAYQJIgyqOpUWr8q6JQCs5dl5d0u1ohaKA== X-Google-Smtp-Source: AGRyM1sXmJ0IrT5s4vsD8rGNibNQmCDytTKyDS/8PMBHtCnSp/+qihYZBizPHMqcdo6sl6aiKP4ui31wQXn0ueXSFOY= X-Received: by 2002:a05:6402:5388:b0:435:71b:5d44 with SMTP id ew8-20020a056402538800b00435071b5d44mr1559794edb.364.1656474592059; Tue, 28 Jun 2022 20:49:52 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Bart Schaefer Date: Tue, 28 Jun 2022 20:49:40 -0700 Message-ID: Subject: Re: Questions regarding _hosts completion extension To: "Mikhail f. Shiryaev" Cc: Zsh hackers list Content-Type: text/plain; charset="UTF-8" X-Seq: 50395 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: On Mon, Jun 27, 2022 at 2:37 PM Mikhail f. Shiryaev wrote: > > It doesn't use cache features, so the shell instances don't share the state between them > It fills up the _cache_hosts only once at the first completion, and the only way to refresh it is `unset _cache_hosts`. A bit obscured Related https://zsh.org/workers/49676 which was put off for "code freeze" even though clearly code didn't actually freeze then. > If one wants to extend the function with his values, then a way to go suggested on the Internet is defining a style `zstyle -e ':completion:*:hosts' hosts 'reply=(...)`. Unfortunately, it completely overrides the original function. You can always write a new function e.g. _my_hosts that calls _hosts as a fallback, and then just do (after compinit) compdef _hosts ssh ... Alternately, functions -c _hosts _original_hosts _hosts() { # do your own thing, else _original_hosts } > If `reply` executes any function or binary under the hood, the terminal hangs after each pressing. [...] > I'd like to ask about your opinion [...] For example, if async shouldn't be used in completion. Elaborating on what Eric said ... without some pretty fancy plumbing, a background job can't return results into the completion. Glancing at your code, it looks like you're filling the cache files in the background, which means your TAB-press results will include a gradually increasing subset of possible matches (possibly none, the first time) until the cache finishes filling. I guess that's OK if it's more important to you to be able to keep typing than to have accurate results, but you may have an uphill battle to get something like that into the upstream. I haven't tried to work out what happens if you start a completion in a second shell before the background cache-fill has finished in the first shell.