From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12393 invoked by alias); 1 Jun 2018 17:46:32 -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: 23423 Received: (qmail 5427 invoked by uid 1010); 1 Jun 2018 17:46:32 -0000 X-Qmail-Scanner-Diagnostics: from mail-ot0-f169.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(74.125.82.169):SA:0(-1.9/5.0):. Processed in 0.547443 secs); 01 Jun 2018 17:46:32 -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, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_PASS, T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: sgniazdowski@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=V0SG2AxKZmEdHETgdH1QESzzAM7hQRitvH53U4RXXMI=; b=usceY/xv6IlKGWzcvDU13leymwoCQ2dJ+SETZqE4SMJvJfD0IbvTKs6XC7VtAnExqr ztIsgLlSophs78kMeMqrjG/xzRsc1NAqkbmVyhv26z+XOULpIOVm4faXPinHiJ3BsYSp a/1jnLXFHN110J1Yx4J1XZDJIq8vD/fG4yoUDTT/3PXXZZSXH5bVcoeaU9NvqraQcH72 oneip5dl5Of6o7rvzuKljPVYxWPUFYeCJhMDdlZybV0N7lBOk2EIGqfwfo1D6QdGDI3g fZxI5QZiCxNH3Yet6tG0gcy+C8epuxJ3Z9uKmzJDBi90rTu9OkcVA5zKDH5/K+TA0GSy jbSA== 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=V0SG2AxKZmEdHETgdH1QESzzAM7hQRitvH53U4RXXMI=; b=mrCn5KMOZ5o/0YfKWHc96InfuhP/hsL3NPQjoQgmT6wwI83PoAVp54YhqqaJAx7z9a JQ0NILnLnUO8dNa3zvIwg8gKKJo4c452vTits3cUTelmd2h6LxLBQVUqSpIVRnmZmFF8 85JNKHbSqKE1Fa4IsNA3i3scHCpeoxjUnVV25vcz89eWLe451b9snULA03Gy7J9f+FM4 pXAWqr0ytBexTxxoY4HsQKKZtFfxXYhgWi3ZtfMcDj0oiOTImWdvJQAr892toqELT/ch zsGLmAsCLUmWs8X7SfIhs4pm1nqb8fSdpsvGsTC4ok6xXn8CnYuImysInp2ERSECUmpB 3p4w== X-Gm-Message-State: APt69E0OC1CKYgCCikBSbtn8k2grTHizHzAbu0bvtvtysWaVvFO+bP9f NFTVZqwfymQWx4lKbUYzeVXhqCsV0w59qdPre8Y= X-Google-Smtp-Source: ADUXVKKPF3L88BG8HLDZD/T61xhlG3kFMzGhuDraCuFIUiyhT8IdOK3g8LTYMEzUD7yud/B0u8xQ6SlKnl+yTu5TMa4= X-Received: by 2002:a9d:269b:: with SMTP id l27-v6mr8454002otb.174.1527875188821; Fri, 01 Jun 2018 10:46:28 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: <20180601145818.GC17967@robusta> From: Sebastian Gniazdowski Date: Fri, 1 Jun 2018 19:46:08 +0200 Message-ID: Subject: Re: detect if compinit was run and rerun To: Mikael Magnusson Cc: Paul Seyfert , Zsh Users Content-Type: text/plain; charset="UTF-8" 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]=_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