Insert repl options at top of file based on user's choices.

Also rely less on global options.
Fixes #1213.
I still think this i strange. Why are we showing an error element saying that no error happened?

Are you saying that we are failing to report errors in some case?