From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29292 invoked by alias); 1 Jun 2018 14:58:26 -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: 23419 Received: (qmail 12177 invoked by uid 1010); 1 Jun 2018 14:58:26 -0000 X-Qmail-Scanner-Diagnostics: from mail-wm0-f54.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.54):SA:0(-1.9/5.0):. Processed in 4.289273 secs); 01 Jun 2018 14:58:26 -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: pseyfert.mathphys@gmail.com X-Qmail-Scanner-Mime-Attachments: |signature.asc| X-Qmail-Scanner-Zip-Files: | DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:mime-version:content-disposition :user-agent; bh=ib+oH4ErKBs3agr+/9+OC4pHfgQvndQUNRefy6cjxws=; b=neAoFye5BIy1s7drb9pamqeMiWgctaDhKi8rnuvyiPrLVCJkVyISPvMe5BgI3tkmBg DW2cV5O5sq1vtEClNT1AT5Nj1G1m/swXd2l9zHCDqfCBPR0qiHmCh/Txgn6T0ZbcxWbZ jo+DgnoM11hjVQki+zyY9VrSoyQWLtjsya88SK4qaPjv7Q83HYK5Ma2qVIdN/+tBbWR/ CXMSFt2VPnCmLVs0aeu6N08Oh6+joqV1hyPoDB9FUSkb52PXMa8da27u9PBGPHeDFi5o S8lNRMHXxh+DOYNXximmsZ42pOYIST9OzAuj9shnWZHawW5oOwKnGj0u3N3y4WFmaErz Arxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:mime-version :content-disposition:user-agent; bh=ib+oH4ErKBs3agr+/9+OC4pHfgQvndQUNRefy6cjxws=; b=d4TRPsnmPXYEkeOel9WZxIer7UpJB3eRJ0e/nwe9Gi1kdYGijvVPOBHB/aZzbg2D9G NYXUIpLHySW8sTZ3SmesvBhi3Z0LJJKJ+5nlfbT9WlCgZAjwgGXsdGZ9lf5elzZvfxBo V0CkfJM1eJyJ7jplREgsURstgvirmkLb/R7rQ7HAjxyDDp8VQVgkrQKo5sBD1B1zYPs4 kk8DAWHgh/IJBF2D94FvfWA0oj4YXR4tlO4qDsNFuP/jZde45fBYbm+/xJAaq6ZRJWzR Tb6qmTWiocL6F7NytAkCDw9REqu5mlJIuCOfFEdCrOcO1MnyZ0hz74kzTU9j3Q9hJCM0 9+Yw== X-Gm-Message-State: ALKqPwcqXzxVKQi5oHK4Bd4RtV1HorCo5zO15U3Shq1MXMtFeRomzB+W n2YlA/x+y5hGXqib5jo1827Ixhfc X-Google-Smtp-Source: ADUXVKLBYvZLG3eukLBa/2ysAu67btSdv4vaqY0vCPYlrZWByFnp8zVbiKqXlSiKd94WEKdkYC82+A== X-Received: by 2002:aa7:d5d1:: with SMTP id d17-v6mr12602478eds.312.1527865097960; Fri, 01 Jun 2018 07:58:17 -0700 (PDT) Date: Fri, 1 Jun 2018 16:58:19 +0200 From: Paul Seyfert To: Zsh Users Subject: detect if compinit was run and rerun Message-ID: <20180601145818.GC17967@robusta> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="IpbVkmxF4tDyP/Kb" Content-Disposition: inline User-Agent: Mutt/1.10.0 (2018-05-17) --IpbVkmxF4tDyP/Kb Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Dear all, We are working on a small script that is supposed to be sourced to set up some environment for a user. I.e. it mostly prepends to PATH, LD_LIBRARY_PATH, MANPATH, PYTHONPATH, CMAKE_PREFIX_PATH. For the additional commands, we would also like to provide tab completions. The plan is atm to have them all in one directory which would be prepended (appended?) to $fpath. As far as I see, manipulating $fpath doesn't change the completion behaviour until `compinit` is run. As far as I know it corresponds the zsh design to not force completion on the user unless they ask for it, therefore I don't want to blindly run compinit in the script (if a user does not call `compinit`, I don't do it for them). On the other hand I don't want to annoy users with "yes, you already called `compinit` in your .zshrc, but you need to do it again". I am therefore wondering if I can detect if `compinit` has already been called and rerun it if so. Do you have suggestions how to approach this? I drafted: ( compdef ) ; [ $? != 127 ] && compinit ; Ideally I would reuse its settings. I.e. if a user ran `compinit` with -i or -C originally, our script shouldn't run `compinit` w/o. Thanks, Paul --IpbVkmxF4tDyP/Kb Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEcFDPbwcDMXIqhMOzFyx2n1uoY8wFAlsRXwYACgkQFyx2n1uo Y8xSmhAApad/Dc7dhJMVq+/Qa9n6zxgBDqb+QenNyFZBCLkKVOo4ACHCuH68w1iG TWgCI4HjyQ/kTmsQmTtn5OpMyh+BffCpsQrIzNvDhbgMBm2G/sIiJJWNHxq1B3yn /uwGyMCm1q9bmhmvdUL6r7T6D6mVbvBCl5i79udAtyUuB4Q0Bi/tj0MN6VvDsUyV AJdeKAFKdbYYrVOha5Nu2JnYzShgjdecEe/NmPzgUNvx0Un/Gd6N2wFKlYwyLVz4 pGLrpUU99w0CBUnLjl9iI5gYAe/f5hyur6E+1QWwxyEn9ivRsJDI15BKvlKvWQlU q0GlLZ2E0R8ANsUxeJn2qqPEAwHGGjdIbnaU/TekQyS/fOiZVcgZUmhBNUQTRLBS 5D6G3vHqCEhySaGuZbJyixthYX1CVF696X/f4IoqU03S7Oogctr6HfOG8pxhFkpc p0641ODAE2KNIize41L6/648N7Yji6csnOO4vciyvGXefCGCsVEl19JnyN4NEV7W afgvEOho0saqucKCtat5zLviql5xRbzR9XO5OjnnB1tQtRi7tOJaDLS5KJts+7QS mh2WY1i4BSBO/VW8wFQcpWhTs6zhMEAH1dM2vA0+a6Xg/6wXOEz//nhQ5QHI/CxF zL/eiUjDmB6ZtIHSDZM0kUPSD2CWKBnpl0D54P2ZXSCtx+bpe9k= =lEGL -----END PGP SIGNATURE----- --IpbVkmxF4tDyP/Kb--