unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Henrik Enberg <henrik.enberg@telia.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: mode for a region?
Date: Sun, 27 Nov 2005 19:51:27 +0100 (CET)	[thread overview]
Message-ID: <20051127185127.A17963F97@rocksteady.printf.se> (raw)
In-Reply-To: <MEEKKIABFKKDFJMPIOEBOEKLCNAA.drew.adams@oracle.com>

> From: "Drew Adams" <drew.adams@oracle.com>
> 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.

<ftp://dlpx1.dl.ac.uk/fx/emacs/multi-mode.el>

  reply	other threads:[~2005-11-27 18:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-27 18:36 mode for a region? Drew Adams
2005-11-27 18:51 ` Henrik Enberg [this message]
     [not found] <mailman.16951.1133116592.20277.help-gnu-emacs@gnu.org>
2005-11-27 18:44 ` leon
2005-11-27 18:46 ` Ralf Angeli
2005-11-27 20:15   ` Drew Adams
2005-11-27 22:17 ` Tim Johnson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20051127185127.A17963F97@rocksteady.printf.se \
    --to=henrik.enberg@telia.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).