From: Paul Seyfert <pseyfert.mathphys@gmail.com>
To: Zsh Users <zsh-users@zsh.org>
Subject: detect if compinit was run and rerun
Date: Fri, 1 Jun 2018 16:58:19 +0200 [thread overview]
Message-ID: <20180601145818.GC17967@robusta> (raw)
[-- Attachment #1: Type: text/plain, Size: 1197 bytes --]
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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next reply other threads:[~2018-06-01 14:58 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20180601145937epcas3p38d330847971b65037b3a1596f186f9e9@epcas3p3.samsung.com>
2018-06-01 14:58 ` Paul Seyfert [this message]
2018-06-01 15:52 ` Peter Stephenson
2018-06-01 17:12 ` Mikael Magnusson
2018-06-01 17:46 ` Sebastian Gniazdowski
2018-06-14 15:12 ` Paul Seyfert
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180601145818.GC17967@robusta \
--to=pseyfert.mathphys@gmail.com \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).