0

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?

Thanks.

-E

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

Drew
  • 75,699
  • 9
  • 109
  • 225
Erik Bennett
  • 143
  • 7
  • 3
    Please have a look at a google search for “emacs multiple modes” and try out the options that pop up. – Dan Apr 02 '19 at 10:59
  • 1
    You find [a reference of `mmm-mode`](https://emacs.stackexchange.com/questions/20136/pythontex-and-auctex) with a configuration example [in that answer to another question](https://emacs.stackexchange.com/a/20150/2370). From my point of view this question is actually a [duplicate of that other question](https://emacs.stackexchange.com/q/20136/2370). – Tobias Apr 02 '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 02 '19 at 14:47
  • @Drew [Better?](https://emacs.stackexchange.com/q/20136/2370) I admit I was not very original with the new name;-). – Tobias Apr 02 '19 at 14:56
  • @Tobias: Definitely. Thx. – Drew Apr 02 '19 at 16:29
  • @Tobias So, I did search before hand and didn't see the one mentioned. Should I change the title? To what? In any case, thanks. I'll look around. -E – Erik Bennett Apr 02 '19 at 19:57
  • @ErikBennett Hi Erik, if [the linked post](https://emacs.stackexchange.com/a/20150/2370) answers your question everything is fine and you did great in improving the site with your question. The title of the other question has been generalized so that a search for `multiple modes in one buffer` gives that answer as one of the first results. It should be relatively simple to adapt the [linked solution](https://emacs.stackexchange.com/a/20150/2370) to your problem. Side note: I found the other post by a tag search with search string `[multiple-modes]`. – Tobias Apr 02 '19 at 22:07
  • @Tobias The linked post should answer the question. The problem now is that I haven't written any lisp code since the 80s for emacs 18. For example, I don't know what `:save-matches` does. It's a different question for a different post. This is enough for me to chew on for a while. Thanks! -E – Erik Bennett Apr 02 '19 at 22:22
  • You get an info documentation shipped with mmm-mode. See `M-: (info "(mmm) Paired Delimiters")` for a description of `:save-matches`. – Tobias Apr 02 '19 at 22:43

0 Answers0