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

Re: emulate & xtrace



On Feb 23, 11:01am, Peter Stephenson wrote:
}
} I'm thinking (post 4.3.17) of trying to make the "emulate" command leave
} on the "xtrace" option if running inside a function and the nearest
} enclosing function has "functions -t" set.  Before I look at this, can
} anybody see if this is a bad idea?  (Obviously "unsetopt xtrace" still
} does what you expect).

I'd almost be inclined to leave xtrace alone regardess of functions -t
but I don't see any harm in doing it the way you've described.  Note
that emulate already leaves xtrace unchanged without the -R option:

torch% setopt xtrace; emulate zsh -c 'print $options[xtrace]' 
+Src/zsh:9> emulate zsh -c 'print $options[xtrace]'
+(eval):1> print on
on

torch% setopt xtrace; emulate -R zsh -c 'print $options[xtrace]'              
+Src/zsh:8> emulate -R zsh -c 'print $options[xtrace]'
off

There may be a few of other options that might get similar treatment,
e.g., DEBUG_BEFORE_CMD and EVAL_LINENO (which is out of alpha order in
zsh.h, by the way), HUP and RCS, possibly ERR_EXIT and ERR_RETURN.
Are there good reasons to reset those even with "emulate -R"?  (It's
a bit tougher with those last two.)



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