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

Re: emulate zsh *except* pushd related options



On Dec 22,  9:30am, Dominik Vogt wrote:
}
} Is there a (safe!) way to say "emulate zsh but don't touch certain options"?

The "emulate" command accepts the same "-o optionn_name" (or "+o") as
shell startup, so you can do

    emulate -L zsh -o shwordsplit ...

For your specific use case, the current state of the pushd and cd options
can be enumerated this way:

    ${(Oa)${${(kv)options[(I)*pushd*|cd*|*cd]/off/+o}/on/-o}}

That won't work in general because some options have "on" as a substring
of the option name.

So if your autoloaded function begins with:

    emulate -L zsh -o shwordsplit \
      ${(Oa)${${(kv)options[(I)*pushd*|cd*|*cd]/off/+o}/on/-o}}

you should get what you want.



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