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

autoload and alias expansion question



Hello,

I have a question about alias expansion within autoloaded functions.
I'm working on a script library where I'd like to use global aliases,
but somehow can't get it to work.

To demonstrate:

hegedus@su20% echo $ZSH_VERSION
4.3.4
hegedus@su20% FPATH+=:.
hegedus@su20% alias ECHO=echo
hegedus@su20% w DATE
DATE not found
hegedus@su20% cat >foobar <<EOF
foobar () { }
alias DATE=date ; barfoo () { setopt aliases ; DATE ; ECHO OK }
EOF
hegedus@su20% autoload foobar
hegedus@su20% foobar
hegedus@su20% barfoo
barfoo: command not found: DATE
OK
hegedus@su20% w autoload
autoload: shell built-in command
hegedus@su20%

Please note I didn't use the -U flag to autoload. External aliases are
expanded, but those defined within the autoloaded script are not.
I tried using -k or -z flags, placing the definitions w/in the autoloaded
function, neither made a difference. Sourcing the file directly naturally works.

Do I miss something? Is there a way to make this work?

Thanks,
Peter



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