I thought this was meant to work:
saved_options=$(set +o)
.... do stuff ...
eval "$saved_options"
But it doesn't. Inside command substitution, or even with output going to a pipe (though not with output going to a file), the `set +o` reports toggled options, including `set +o monitor` and `set +o zle`, which turn off job control and command-line editing after the "restoration".
The "not with output going to a file" part means this should work:
saved_options=$(mktemp)
.... do stuff ...
source $saved_options
rm -f $saved_options
But is there a better way?
--