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

Re: completers using zstat don't work with zmodload -F zsh/stat



On 27 July 2011 20:18, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Jul 27,  6:44pm, Mikael Magnusson wrote:
> } Subject: Re: completers using zstat don't work with zmodload -F zsh/stat
> }
> } # alias zstat='builtin stat'
> } # rm $fpath[3].zwc*
> } removed `/usr/local/share/zsh/4.3.12-dev-1/functions.zwc'
> } removed `/usr/local/share/zsh/4.3.12-dev-1/functions.zwc.old'
> } # for a ($fpath) {[ -w $a:r -a $a/_*(N[1]) ] && zrecompile -p -U -z
> } $a.zwc $a/_*}
> } re-compiling /usr/local/share/zsh/4.3.12-dev-1/functions.zwc: succeeded
> }
> } % umount <tab>
> } _canonical_paths_add_paths:6: no such builtin: stat
>
> This must be happening because _canonical_paths_add_paths isn't actually
> defined until _canonical_paths is executed, so the -U option to zcompile
> doesn't have a chance to come into effect.
>
> This is going to be a problem with any completion source file that has
> multiple embedded function definitions.
>
> It MIGHT help to both use "zcompile -a" and also change _canonical_paths
> from using
>
>    _canonical_paths_add_paths () {
>      ...
>    }
>
> to using the load-once paradigm
>
>    (( $+functions[__canonical_paths_add_paths] )) ||
>    _canonical_paths_add_paths () {
>      ...
>    }
>
> but I'm not confident of that.

Hm, but if it's only loaded at "runtime", why does the alias get
expanded then? My user doesn't have the zstat alias. Are aliases still
expanded during compilation inside function definitions but -U is
somehow not active? (This sounds odd).

-- 
Mikael Magnusson



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