Factorize options context setting.