Set major mode of temporary buffers based on their name.