This is kind of a weird question, but I have a file that's a mix of perl, text, and Bourne shell. Is there some (easy) way to have emacs switch major modes at different points in the file?

Perhaps when it sees -*- Text -*- or -*- Perl -*- or something?

Or can I just change it for the region if I narrow-to-region?



I just noticed that there is a tag for "multiple-modes", so I'm hopeful.

  • 3
    Please have a look at a google search for “emacs multiple modes” and try out the options that pop up. – Dan Apr 2 '19 at 10:59
  • 1
    You find a reference of mmm-mode with a configuration example in that answer to another question. From my point of view this question is actually a duplicate of that other question. – Tobias Apr 2 '19 at 14:19
  • @Tobias: Agreed - voted to close as dup. It would be good if Someone (TM) edited that question to present the question more generally and to have a title like this one. – Drew Apr 2 '19 at 14:47
  • @Drew Better? I admit I was not very original with the new name;-). – Tobias Apr 2 '19 at 14:56
  • @Tobias: Definitely. Thx. – Drew Apr 2 '19 at 16:29

Browse other questions tagged or ask your own question.