Automatic Domain Adaptation by Transformers in In-Context Learning