GNU ELPA - mmm-mode


Allow Multiple Major Modes in a buffer
mmm-mode-0.5.11.tar (.sig), 2024-Mar-31, 350 KiB
Dmitry Gutov <>
Atom feed
Browse ELPA's repository
CGit or Gitweb

To install this package from Emacs, use package-install or list-packages.

Full description

                          MMM Mode for Emacs


  MMM Mode is a minor mode for Emacs that allows Multiple Major Modes
  to coexist in one buffer.  It is well-suited to editing:

  * Preprocessed code, such as server-side Ruby, Perl or PHP embedded in HTML
  * Code generating code, such as HTML output by CGI scripts
  * Embedded code, such as Javascript in HTML
  * Literate programming: code interspersed with documentation, e.g. Noweb


  Use any of the following options:

  1. Users of package.el (a.k.a. ELPA) can easily install MMM Mode from
  the ELPA package repository at -- this is the
  preferred and best-supported installation mechanism.

  2. Since currently MMM Mode is written in pure Emacs Lisp, you could just
  copy all the *.el files in the distribution to a directory in your
  `load-path', and optionally byte-compile them manually (see the Emacs
  Manual). The Makefile has a target to build the MMM Mode info manual, so if
  you're installing manually you might want to do that too.  Put the
  file somewhere on your Info-path and use install-info to generate or update
  the dir file.


  Once MMM Mode is installed, it has to be configured correctly.  This
  can be done in a site-start file or in user's initialization files;
  usually the latter is preferable, except possibly for autoloads.
  First the package needs to be loaded, with either

    (require 'mmm-mode)

  or instead, to save time during emacs startup,

    (require 'mmm-auto)

  Then you will probably want to set something like this:

    (setq mmm-global-mode 'maybe)
    (mmm-add-mode-ext-class 'html-mode "\\.php\\'" 'html-php)

  The first line tells MMM Mode to load itself whenever you open an
  appropriate file, and the second is an example which says to notice
  PHP regions in html-mode files having a `.php' extension.  Both
  lines are necessary.

  You will, of course, want to change and duplicate the second line
  according to your needs. either of the first two parameters can be
  `nil', meaning not to consider that criterion.  For example, if all
  your html files, regardless of extension, are Mason components, you
  will want something like:

    (mmm-add-mode-ext-class 'html-mode nil 'mason)

  whereas if all your files with a `.nw' extension, regardless of
  primary mode (some may be LaTeX, others HTML, say) are Noweb, you
  will prefer

    (mmm-add-mode-ext-class nil "\\.nw\\'" 'noweb)

  See the info file for more extensive documentation, and for other
  configuration options.


  For further information, see (in order) the accompanying info file,
  the documentation strings of functions and variables, the comments
  in the source code, and the source code itself.


  The latest version of MMM Mode should always be available from


  Bug reports, suggestions and questions can be submitted at

  Thanks for using MMM Mode!

Old versions

mmm-mode-0.5.10.tar.lz2023-Sep-1776.7 KiB
mmm-mode-0.5.9.tar.lz2022-Oct-2877.0 KiB
mmm-mode-0.5.8.tar.lz2020-May-25 146 KiB
mmm-mode-0.5.7.tar.lz2018-Jun-21 146 KiB
mmm-mode-0.5.6.tar.lz2018-Mar-24 146 KiB
mmm-mode-0.5.5.tar.lz2018-Mar-16 136 KiB


MMM Mode NEWS -- history of user-visible changes.  -*-outline-*-
Copyright (C) 2003, 2004, 2013-2022  Free Software Foundation, Inc.
See the file COPYING for copying conditions.

Please submit bug reports at
* Changes in MMM Mode 0.5.11

The codebase migrated to use lexical-binding.

Documentation updates.

* Changes in MMM Mode 0.5.10

Functions mmm-add-find-file-hooks and mmm-add-find-file-hook have been
removed (GH#137).

* Changes in MMM Mode 0.5.9

Made the tests work in batch mode.

Switched from Automake to plain Makefile.

Now requires at least GNU Emacs 25.1.

Info documentation can be generated by the GNU ELPA packager.

New here document class for shell.  The new class handles indented
here documents, which are incompatible with the mmm classes shared
with Perl.
* Changes in MMM Mode 0.5.8
Support for Emacs 27.

Fixes for nesting submodes.
* Changes in MMM Mode 0.5.7
Fixes for mmm-indent-line-narrowed.
* Changes in MMM Mode 0.5.6
Emacs 25 compatibility fix when cl is not loaded.
* Changes in MMM Mode 0.5.5

Introduced mode transition hooks, like mmm-x-enter-hook and mmm-y-exit-hook.

New function mmm-indent-line-narrowed, to use as mmm-indent-line-function.

`cl-lib' is a new dependency, replacing `cl'. It comes bundled with
recent versions of Emacs, and for older ones it can be installed from

* Changes in MMM Mode 0.5.4

Fixes for indentation, SMIE support, and minor bugs.

* Changes in MMM Mode 0.5.2

Introduced `mmm-after-syntax-propertize-functions'. A primary major
mode can set it to adjust `syntax-table' text properties in submode

New file `mmm-defaults.el'. A user can simply require it and have
basic setup for ERB, EJS and PHP files (for the last one, `php-mode'
has to be installed separately).

`mmm-add-classes' is autoloaded.

`mmm-beginning-of-syntax' was removed.

Assorted highlighting and syntax detection improvements.

* Changes in MMM Mode 0.5.1

Some minor documentation updates and bugfixes.

* Changes in MMM Mode 0.5.0

** Compatibility with recent Emacsen

Updated to work with Emacs 23 and 24. Removed some compatibility code
for older versions. Added new local variables used in the latest js-mode
and cc-engine modes.

** New submode classes

New submode classes for ERB and EJS templates, both in mmm-erb.el. It
also includes a smart indentation algorithm, supporting them together
with script and style tag subregions in HTML code.

** Parsing when idle

Setting `mmm-parse-when-idle' will make MMM Mode re-parse modified
buffers when Emacs is idle. This can lead to visible pauses, though,
depending on the size of the buffer and the number of subregions.

** Support submode-specific syntax functions

Relevant for Emacs 24: we define a composite syntax-propertize-function
that delegates syntax recognition to respective submode functions.

For users, this means regular expressions in js-mode and string
interpolations and percent literals in ruby-mode.

** Indentation

More consistent indentation behavior, the default implementation
delegates to the submode at the end of the indentation.

The major mode can provide its own implementation by setting
mmm-indent-line-function, to handle specific mode combinations better.

* Changes in MMM Mode 0.4.8

** Delimiter Regions

The delimiters which mark off submode regions now have their own
overlays.  They can be highlighted if you so desire using appropriate
class arguments and/or the variable mmm-delimiter-face.  They are also
in an appropriate major mode, or non-mode as the case may be.

** Nested Submodes

Nested submodes are now vaguely supported.

** RPM Spec File

An RPM spec file, contributed by <>, is now
included for people who wish to build their own SRPM to install from.

** New Submode Classes

Many thanks to Joe Kelsey for writing a very intelligent class for
editing Noweb files, and to Alan Shutko for one for CWeb files.  We
also have a mode for SGML DTD definitions from Yann Dirson.