6

So I know that I can put at the first or second line of a file a line such as:

# -*- mode: conf -*-

to tell Emacs what major mode I want the file to be opened with.

But if that mode isn't installed I wish Emacs to fallback to a different mode. For example I wish to use the apache-mode, but if it doesn't exist I wish to fallback to conf-mode.

Is this possible, and if so how?

Chen Levy
  • 385
  • 3
  • 12

1 Answers1

10

Found it:

# -*- mode: conf; mode: apache -*-

It seems that the last valid mode wins, so I need to put the my wanted mode last, and the fallback mode(s) before it.

Chen Levy
  • 385
  • 3
  • 12
  • 1
    Interesting. I suspect that will activate all the named modes (those that are available at least), one after the other. This should do no harm, but might be a bit time consuming. It's a handy trick, though. – Harald Hanche-Olsen Aug 23 '18 at 08:18