From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17023 invoked by alias); 14 Jun 2018 15:12:41 -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: List-Unsubscribe: X-Seq: 23488 Received: (qmail 27241 invoked by uid 1010); 14 Jun 2018 15:12:40 -0000 X-Qmail-Scanner-Diagnostics: from mail-io0-f180.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(209.85.223.180):SA:0(-1.9/5.0):. Processed in 1.319593 secs); 14 Jun 2018 15:12:40 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_PASS,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: pseyfert.mathphys@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=SvDHYyJ80u8gUBT9yt/jFU3i9HC9eByjsT/Kk57Hsag=; b=BldTQQvDa20r2Oo6VPfyMHqghthz6URjC5CbVQ60KAM0a10dmCYfxLDg56h6kshgop eJkKKK0JQHAwo6YNcPynPbLtoEk4ITLmaAFqVceCCUnt7UMUqr30QRpay6Ww7Tyj0rtY yE9qBVXOQvNdmoHfgxiUq23LwnFpGPwsBxn0dnoTuF5ji0FQwlF0mtQ3tjI+FlS2W4Dd reUdv1R2HNWjc6gQcOAHiXJ9EsAR1TsWwNoz0Qp3aVp8UYrFauEgbNHNk4Z5qgtFMi7e ERspEXD3PhJNyV83e1UwSvHXxhvQ8JLYpcwO9Fa3SMUfW4xEBtRLKJd7fNpIGMpFcAg7 nPNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=SvDHYyJ80u8gUBT9yt/jFU3i9HC9eByjsT/Kk57Hsag=; b=PpOflGC7YNytHE8m7stfCRpZiqocS2DQAYDQgQ4dH7xodHz9JwujkkHLyEXfUngKO9 ubveXlqodKuEG+q11pw90KHPLaSAFrVFonLl3ZH8J2KnEgKDJFPEahziZyCZ36BdjRxS qbFgwk8j/C+4jISyK5f9GhhhgwU32ztWycZd4VU12gECpInufPweX0GXgxDUfh0suCGK qO3jx85kH9SEnSOngVeFiOdRyjA875JFr3m8peOKx3Yw80PFba3g48xdCBsGyhpTC1wq 2E0f0Z44hHJZnhDO3kc6XRcgbuV4vgqzvHdyqCC1Z59hjnt1dzOyVEDJBiktMbX0Vsuw EhgQ== X-Gm-Message-State: APt69E31UhlZJ6NEQnUNXqiNGiewTKCVsIwXDiRZ/JMoZiey7L3hYriE H8NQFJrIkJ7eCxi/pxheH/iaYTcHszre+iOMc64= X-Google-Smtp-Source: ADUXVKJWbOX0UQfZ3OkDGZ3D2jnuAFjRU+gP5ot86/LB3Ox0XOlJ9ZVJvmNZ2KjMvYTlrWNZaIbcxfJU5mYmT3Jh6io= X-Received: by 2002:a6b:b288:: with SMTP id b130-v6mr2798888iof.153.1528989156910; Thu, 14 Jun 2018 08:12:36 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: <20180601145818.GC17967@robusta> From: Paul Seyfert Date: Thu, 14 Jun 2018 17:12:36 +0200 Message-ID: Subject: Re: detect if compinit was run and rerun To: Sebastian Gniazdowski Cc: Mikael Magnusson , Zsh Users Content-Type: multipart/alternative; boundary="0000000000009029e1056e9b8790" --0000000000009029e1056e9b8790 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi all, thanks for your replies I would like to avoid suggesting users to extend their fpath themselves: the entire idea of that script we're deploying is there is exactly one place to pick a version of the software stack, so users do not need to edit their shell setup, log out&in to switch versions, which we want to enable them to do after logging in. also our homedirs are shared over different operating systems =E2=80=A6 I appreciate the comment that my idea would hammer zcompdump, I'll try in any case what the time penalty on our systems is. Anyway the snippet by Sebastian looks good and seems to do the job. (And I don't need to worry about users who might call `compinit -u`) Thanks, Paul 2018-06-01 19:46 GMT+02:00 Sebastian Gniazdowski : > On 1 June 2018 at 19:12, Mikael Magnusson wrote: > > regenerations of the cache instead of 0. Instead, you should not do > > that. Just make sure your code that changes fpath is run before the > > user runs compinit (by asking the user to configure their shell > > If this would be about startup of zsh, I would agree as second > compinit call with $fpath changed adds 820 ms. But for some dynamic > Zsh use with things plugged in and out, compinit should be a good > choice, it is specifically adapted to detect changes (it checks number > of _* files AFAIR?). > > > correctly). If you absolutely want to add a completer at runtime, it > > is probably better to use only compdef+autoload and not compinit. I > > don't see any reason why the user would want to avoid having these > > completers always configured though. > > Good point, compinit interiors are quite easy to grasp and manual > plugging is possible. For example, this code is generated by Zplugin's > installer: > > autoload -Uz _zplugin > (( ${+_comps} )) && _comps[zplugin]=3D_zplugin > > This plugs zplugin completion into already initialized completion > system. I'm doing this because until user organizes his .zshrc, some > time typically passes, and with above, during this time zplugin will > have a working completion. The ${+_comps} check detects if completion > is already initialized. > > -- > Best regards, > Sebastian Gniazdowski > --0000000000009029e1056e9b8790--