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

Re: more dependencies on emulation



>Actually, the only options that make this difficult are those that (1)
>affect non-interactive behavior and (2) are not tied to an emulation.
>As long as the "emulate" command sets/unsets all the appropriately-
>tagged options, you can always do:
>
>	zshfoo() {
>	    setopt localoptions
>	    emulate zsh
>	    # Now do stuff using default zsh settings
>	}
>
>Note, though, that for this to work "emulate" should never turn OFF
>localoptions -- I note that it turns it ON for ksh, so right now it
>probably also turns it off sometimes.

This one's easy.  Execute emulate BEFORE setting localoptions.  The
setting of localoptions at the *end* of the function is what determines
which options are restored.

I hadn't considered that use of emulation before.  Do you think maybe
the emulation mode should be restored by localoptions in the way
options are?  Even after my patches, the emulation does have some
direct effect -- the single-letter option names.  I don't think that
should be changed.

-zefram




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