Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Completion issue when zsh is not the default shell



On 2018-10-26 at 20:49 +0200, Julien Nicoulaud wrote:
> suspect this is related to bytecode compilation, I have this snippet at the
> end of my zshrc:
> autoload -U zrecompile && zrecompile -p $MAIN_USER_HOME/.{zcompdump,zshrc}
> &>/dev/null

My understanding is that << zrecompile -p FOO >> passes FOO through as
arguments to zcompile, so you're invoking:

  zcompile $MAIN_USER_HOME/.zcompdump $MAIN_USER_HOME/.zshrc

which is the "zcompile file [ name ... ]" form, so you're compiling
.zshrc into the file .zcompdump (instead of .zshrc.zwc).

I think that just removing the "-p" should work.  (But I've not tried to
reproduce your breakage).


What happens if fpath is broken and zrecompile can't be autoloaded?
What if you fixed such a breakage in .zshrc, but you're not recompiling
and the old fpath is still being used from the binary file, even while
the source files are correct?

This should be "zsh -e" safe, while still giving you more clues what's
failing if things fail:

if ! autoload -U zrecompile ; then
  print -u2 ".zshrc: warning: failed to autoload zrecompile, is fpath okay?'
else
  zrecompile $MAIN_USER_HOME/.{zcompdump,zshrc} || ev=$?
  if (( ev )); then
    print -u2 ".zshrc: warning: zrecompile failed, exiting $ev"
  fi
fi



Messages sorted by: Reverse Date, Date, Thread, Author