From: Mikael Magnusson <mikachu@gmail.com>
To: zsh-workers@zsh.org
Subject: PATCH: compinit: add -w to explain why compdump runs
Date: Tue, 28 Jul 2020 18:12:19 +0200 [thread overview]
Message-ID: <20200728161219.14587-1-mikachu@gmail.com> (raw)
Sometimes people have trouble with compinit taking a long time, and
having them add -w would be a lot faster than doing a bunch of manual
checks to see if compdump runs again.
---
Completion/compinit | 25 +++++++++++++++++++++++--
1 file changed, 23 insertions(+), 2 deletions(-)
diff --git a/Completion/compinit b/Completion/compinit
index f0f8421df8..6166d8ae26 100644
--- a/Completion/compinit
+++ b/Completion/compinit
@@ -71,9 +71,9 @@ emulate -L zsh
setopt extendedglob
typeset _i_dumpfile _i_files _i_line _i_done _i_dir _i_autodump=1
-typeset _i_tag _i_file _i_addfiles _i_fail=ask _i_check=yes _i_name
+typeset _i_tag _i_file _i_addfiles _i_fail=ask _i_check=yes _i_name _i_why
-while [[ $# -gt 0 && $1 = -[dDiuC] ]]; do
+while [[ $# -gt 0 && $1 = -[dDiuCw] ]]; do
case "$1" in
-d)
_i_autodump=1
@@ -99,6 +99,10 @@ while [[ $# -gt 0 && $1 = -[dDiuC] ]]; do
_i_check=
shift
;;
+ -w)
+ _i_why=1
+ shift
+ ;;
esac
done
@@ -484,11 +488,28 @@ if [[ -f "$_comp_dumpfile" ]]; then
then
builtin . "$_comp_dumpfile"
_i_done=yes
+ elif [[ _i_why -eq 1 ]]; then
+ print -nu2 "Loading dump file skipped, regenerating"
+ local pre=" because: "
+ if [[ _i_autodump -ne 1 ]]; then
+ print -nu2 $pre"-D flag given"
+ pre=", "
+ fi
+ if [[ $_i_line[2] -ne $#_i_files ]]; then
+ print -nu2 $pre"number of files in dump $_i_line[2] differ from files found in \$fpath $#_i_files"
+ pre=", "
+ fi
+ if [[ $ZSH_VERSION != $_i_line[4] ]]; then
+ print -nu2 $pre"zsh version changed from $_i_line[4] to $ZSH_VERSION"
+ fi
+ print -u2
fi
else
builtin . "$_comp_dumpfile"
_i_done=yes
fi
+elif [[ _i_why -eq 1 ]]; then
+ print -u2 "No existing compdump file found, regenerating"
fi
if [[ -z "$_i_done" ]]; then
typeset -A _i_test
--
2.15.1
reply other threads:[~2020-07-28 16:13 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20200728161219.14587-1-mikachu@gmail.com \
--to=mikachu@gmail.com \
--cc=zsh-workers@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).