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

Re: Truncate $functions



On 16 February 2016 at 05:51, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Feb 15,  8:31pm, Sebastian Gniazdowski wrote:
> }
> } Thank you, this works really well.
>
> As an additional note -- functions that look like
>
>     sample () {
>         # undefined
>         builtin autoload -X
>     }
>
> should be restored as
>
>     autoload sample

Indeed.. otherwise problems that the --reload-and-run function fixed
will appear. Or maybe not? Before, we were trying assignment to
functions or eval. Here it's plain script body. Wonder how I could
test for any problems quickly, will probably leave the issue for a
while

> except that you can't know which of the -U -k -z options was specified
> the first time the name was marked for autoload, so there's no way to
> get this entirely right.

Looking at define's -f output I have:

_a2ps () {
        # undefined
        builtin autoload -XUz
}
_a2utils () {
        # undefined
        builtin autoload -XUz
}
_aap () {
        # undefined
        builtin autoload -XUz
}

...

So it looks like I can have the options by parsing functions body?

> The other drawback to this scheme is that you can't save and restore
> the "sticky emulation" bits of any of the functions.

Slightly acceptable limitation, user will be told "don't change
emulate modes". Anyone doing emulate sh will break his session anyway
because of for example SHGLOB. That said, the snapshot could cover
emulate modes and restore them too..

Best regards,
Sebastian Gniazdowski



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