validate codemirror_mode