summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordana <dana@dana.is>2026-05-02 14:06:50 -0500
committerdana <dana@dana.is>2026-05-02 14:09:17 -0500
commitb40b7e908aa3df8716a1be1e1958a7a3f2ca57ab (patch)
treee27e01b9ba2506e172226eb926c034f0b8ca70a2
parentunposted: tests: add basic tests for _describe (diff)
downloadzsh-b40b7e908aa3df8716a1be1e1958a7a3f2ca57ab.tar
zsh-b40b7e908aa3df8716a1be1e1958a7a3f2ca57ab.tar.gz
zsh-b40b7e908aa3df8716a1be1e1958a7a3f2ca57ab.tar.bz2
zsh-b40b7e908aa3df8716a1be1e1958a7a3f2ca57ab.tar.lz
zsh-b40b7e908aa3df8716a1be1e1958a7a3f2ca57ab.tar.xz
zsh-b40b7e908aa3df8716a1be1e1958a7a3f2ca57ab.tar.zst
zsh-b40b7e908aa3df8716a1be1e1958a7a3f2ca57ab.zip
54423 (tweaked): compinit: improve and document -w
also add new-line after compaudit prompt tweaked -D/-w exclusions in _compinit
-rw-r--r--ChangeLog4
-rw-r--r--Completion/Zsh/Command/_compinit4
-rw-r--r--Completion/compinit10
-rw-r--r--Doc/Zsh/compsys.yo3
4 files changed, 16 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 08b9a2b06..d00c65300 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2026-05-02 dana <dana@dana.is>
+ * 54423 (tweaked): Completion/Zsh/Command/_compinit,
+ Completion/compinit, Doc/Zsh/compsys.yo: compinit: improve and
+ document -w
+
* unposted: Test/Y05describe.ztst: add basic tests for _describe
* unposted: Test/Z04zgetopt.ztst: zgetopt: make sure zsh/zutil
diff --git a/Completion/Zsh/Command/_compinit b/Completion/Zsh/Command/_compinit
index e97095d7f..eed4dacb8 100644
--- a/Completion/Zsh/Command/_compinit
+++ b/Completion/Zsh/Command/_compinit
@@ -3,7 +3,7 @@
_arguments : \
'(-i -u)-C[bypass security and dump-file checks]' \
'-d+[automatically create dump file / specify dump-file path]::dump file:_files' \
- "(-w)-D[don't automatically create dump file]" \
+ "-D[don't automatically create dump file]" \
'(-C -u)-i[ignore insecure files]' \
"(-C -i)-u[don't check for insecure files]" \
- '(-D)-w[explain why dump file is created]'
+ "-w[explain why dump file isn't loaded]"
diff --git a/Completion/compinit b/Completion/compinit
index 60dbb599d..f1280fc60 100644
--- a/Completion/compinit
+++ b/Completion/compinit
@@ -461,6 +461,7 @@ if [[ -n "$_i_check" ]]; then
if ! read -q \
"?zsh compinit: insecure $_i_q, run compaudit for list.
Ignore insecure $_i_q and continue [y] or abort compinit [n]? "; then
+ print -u2
print -u2 "$0: initialization aborted"
unfunction compinit compdef
unset _comp_dumpfile _comp_secure compprefuncs comppostfuncs \
@@ -468,6 +469,7 @@ Ignore insecure $_i_q and continue [y] or abort compinit [n]? "; then
return 1
fi
+ print -u2
fi
fpath=(${fpath:|_i_wdirs})
(( $#_i_wfiles )) && _i_files=( "${(@)_i_files:#(${(j:|:)_i_wfiles%.zwc})}" )
@@ -484,6 +486,8 @@ autoload -RUz compdump compinstall
_i_done=''
+[[ _i_why -eq 1 ]] && print -ru2 "Using dump file: $_comp_dumpfile"
+
if [[ -f "$_comp_dumpfile" ]]; then
if [[ -n "$_i_check" ]]; then
IFS=$' \t' read -rA _i_line < "$_comp_dumpfile"
@@ -493,7 +497,7 @@ if [[ -f "$_comp_dumpfile" ]]; then
builtin . "$_comp_dumpfile"
_i_done=yes
elif [[ _i_why -eq 1 ]]; then
- print -nu2 "Loading dump file skipped, regenerating"
+ print -nu2 "Loading dump file skipped"
local pre=" because: "
if [[ _i_autodump -ne 1 ]]; then
print -nu2 $pre"-D flag given"
@@ -513,8 +517,9 @@ if [[ -f "$_comp_dumpfile" ]]; then
_i_done=yes
fi
elif [[ _i_why -eq 1 ]]; then
- print -u2 "No existing compdump file found, regenerating"
+ print -u2 "No existing dump file found"
fi
+
if [[ -z "$_i_done" ]]; then
typeset -A _i_test
@@ -547,6 +552,7 @@ if [[ -z "$_i_done" ]]; then
# If autodumping was requested, do it now.
if [[ $_i_autodump = 1 ]]; then
+ [[ _i_why -eq 1 ]] && print -u2 "Regenerating dump file"
compdump
fi
fi
diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo
index fbfccf82e..83032b54f 100644
--- a/Doc/Zsh/compsys.yo
+++ b/Doc/Zsh/compsys.yo
@@ -167,7 +167,8 @@ change, it is easiest to delete the dump file by hand so that
tt(compinit) will re-create it the next time it is run. The check
performed to see if there are new functions can be omitted by giving
the option tt(-C). In this case the dump file will only be created if
-there isn't one already.
+there isn't one already. Use option tt(-w) to explain why a dump file
+isn't loaded and/or why it's regenerated.
The dumping is actually done by another function, tt(compdump), but you
will only need to run this yourself if you change the configuration