I have coded what I hope is an acceptable compromise. Running `qpdf
--completion-zsh` now outputs this without the autoload:
complete -o bashdefault -o default -C '/path/to/qpdf' qpdf
I have changed the _qpdf file to be as follows:
#compdef qpdf
if (( ! $+functions[_bash_complete] && ! $+functions[complete] && !
$+functions[compgen] )); then
# If the user has not loaded bashcompinit and hasn't otherwise
# defined the functions it defines, load it. This enables zsh
# completion to work out of the box for users with no custom
# configuration. See
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1111509 for
# additional discussion.
autoload -U +X bashcompinit && bashcompinit
fi
eval "$(/usr/bin/qpdf --completion-zsh)"
_bash_complete
This appears to fix the two tab bug and also avoids overwriting custom
functions, but as a compromise, it still autoloads bashcompinit if it
looks safe. That way, vanilla users with no custom config still have
working completion for qpdf without custom configuration. I tested
this by logging into a vanilla user on my system, and completion works
without the double tag bug.
In the absence of any additional input, this is what will go in the
next qpdf release.