* mode for a region?
@ 2005-11-27 18:36 Drew Adams
2005-11-27 18:51 ` Henrik Enberg
0 siblings, 1 reply; 6+ messages in thread
From: Drew Adams @ 2005-11-27 18:36 UTC (permalink / raw)
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?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: mode for a region?
[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 22:17 ` Tim Johnson
2 siblings, 0 replies; 6+ messages in thread
From: leon @ 2005-11-27 18:44 UTC (permalink / raw)
"Drew Adams" <drew.adams@oracle.com> writes:
| 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?
That is multimode. Have a look at the following link
http://www.emacswiki.org/cgi-bin/wiki/MultipleModes
--
.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:.
. * .
. /.\ excuses are the easiest things .
. /..'\ to manufacture .
. /'.'\ and the hardest things to sell .
. /.''.'\ .
. /.'.'.\ .
. /'.''.'.\ .
. ^^^[_]^^^ .
. .
.Leon .
.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: mode for a region?
[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
2 siblings, 1 reply; 6+ messages in thread
From: Ralf Angeli @ 2005-11-27 18:46 UTC (permalink / raw)
* Drew Adams (2005-11-27) writes:
> Anyone know of an attempt to deal with mixing two languages, perhaps by
> having a local (region) sub-mode?
mmm-mode
--
Ralf
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: mode for a region?
2005-11-27 18:36 mode for a region? Drew Adams
@ 2005-11-27 18:51 ` Henrik Enberg
0 siblings, 0 replies; 6+ messages in thread
From: Henrik Enberg @ 2005-11-27 18:51 UTC (permalink / raw)
Cc: help-gnu-emacs
> 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>
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: mode for a region?
2005-11-27 18:46 ` Ralf Angeli
@ 2005-11-27 20:15 ` Drew Adams
0 siblings, 0 replies; 6+ messages in thread
From: Drew Adams @ 2005-11-27 20:15 UTC (permalink / raw)
> Anyone know of an attempt to deal with mixing two languages,
> perhaps by having a local (region) sub-mode?
mmm-mode
Thanks to everyone who replied.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: mode for a region?
[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 22:17 ` Tim Johnson
2 siblings, 0 replies; 6+ messages in thread
From: Tim Johnson @ 2005-11-27 22:17 UTC (permalink / raw)
On 2005-11-27, Drew Adams <drew.adams@oracle.com> wrote:
> 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.
Vim does this quite well with Javascript in HTML documents. I can
check up on this, since I am moderately familiar with vim. In fact
the <script> </script> syntax provides a delimiters which the editor
The same could go for an asm construct in C.
> 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?
>
>
>
--
Tim Johnson <tim@johnsons-web.com>
http://www.alaska-internet-solutions.com
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2005-11-27 22:17 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-27 18:36 mode for a region? Drew Adams
2005-11-27 18:51 ` Henrik Enberg
[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
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).