One mode definition file can contain different modes, e.g. clike includes C, C++,
C#, Java, and a few others. We need to use the mime type to distinguish which one
we want.
Closes gh-2737
When the language is selected manually, record the file extension and choice in config
so that future files opened with the same extension use the same mode.
This allows users to teach the editor about file extensions CodeMirror doesn't know about.