Find of the week – two-mode-mode

I just came across two-mode-mode when looking for some xemacs extensions for editing ruby on rails code, and it is awesome.

The basic problem is one that anyone editing PHP, or even HTML with embedded CSS or Javascript has run into. Your editor locks to HTML editing mode, with indentation and font coloring for it, great. Then you get into your code block which is really a different language, and you no longer have an editing mode appropriate to the lines you are changing. Along comes two-mode-mode (or probably better called multi-mode-mode). The primary mode is HTML. Any time you enter blocks that look like something else (i.e. CSS, Javascript, Ruby, PHP, Python) emacs changes modes, re-font-locks, and life is good. You exist the block, and emacs flips you back to HTML mode.

I made a couple minor changes so that PHP mode used PHP, and CSS and Javascript modes were also detected. There were also 2 functions that xemacs didn’t know about, but a quick m-x appropos let me find close enough versions for xemacs. Things like this are another reason I just love xemacs. 🙂

One thought on “Find of the week – two-mode-mode”

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s