[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: mode for a region?

From: Henrik Enberg
Subject: Re: mode for a region?
Date: Sun, 27 Nov 2005 19:51:27 +0100 (CET)

> From: "Drew Adams" <address@hidden>
> Date: Sun, 27 Nov 2005 10:36:12 -0800
> Some languages provide for using expressions of another language within
> them. Some syntactic method is used to identify the other-language
> expression.
> For example, you might have a SQL expression that uses SQL function
> XMLQuery, which takes a (quoted) XQuery expression as an argument. SQL and
> XQuery are different languages, with radically different syntaxes. Another
> example would be Prolog expressions within Lisp (or vice versa). There are
> many languages that let you pass an expression to another language.
> I'm wondering how Emacs modes might have already tried to deal with this (if
> they have).
> What I'm thinking of is something like this: The major mode (e.g. SQL mode)
> recognizes the existence of an expression in the other language (e.g.
> XQuery), and somehow allows for use of a "regional" mode that acts on that
> (e.g. XQuery) expression. "Act on" could be anything - simple font-lock
> highlighting, indentation, syntax-checking, type-checking, or even
> evaluation.
> Anyone know of an attempt to deal with mixing two languages, perhaps by
> having a local (region) sub-mode?

There is mmm-mode, but I don't know how well it works.  I've heard it
has trouble cooperating with cc-mode.

Another option is to write a function that uses `make-indirect-buffer'
coupled with `narrow-to-region' and put that buffer in some different
mode.  The package multi-mode.el uses this approach I think.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]