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

Re: real time alias?

On Fri, Mar 16, 2018 at 9:47 AM, Ray Andrews <rayandrews@xxxxxxxxxxx> wrote:
> $ function test1 ()
> {
>     test2 # unchanged since last sourcing of this function.
>     setopt GRAB_ALIASES_AGAIN test2
>     test2 # Up-to-date.
>     test3
> }

The result of expanding an alias might include parens, braces, pipes,
etc. - it can actually change the parsed syntax of the function body.
So to "grab aliases again" you have to recompile the whole body of the

The original (unparsed) body of the function is not stored anywhere,
so to recompile it you have to get it back from wherever it originally
appeared.  That's easy if the function was autoloaded from your

% unfunction test1; autoload test1

If the function came from some larger file (such as .zshrc), or was
defined at the command line, or was loaded from a plugin manager like
Sebastian's, the details of how to reparse it will vary.

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