From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Henrik Enberg Newsgroups: gmane.emacs.help Subject: Re: mode for a region? Date: Sun, 27 Nov 2005 19:51:27 +0100 (CET) Message-ID: <20051127185127.A17963F97@rocksteady.printf.se> References: NNTP-Posting-Host: main.gmane.org X-Trace: sea.gmane.org 1133117624 13291 80.91.229.2 (27 Nov 2005 18:53:44 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 27 Nov 2005 18:53:44 +0000 (UTC) Cc: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Nov 27 19:53:35 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EgRcq-0001Cf-9m for geh-help-gnu-emacs@m.gmane.org; Sun, 27 Nov 2005 19:51:48 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EgRco-00015h-Hc for geh-help-gnu-emacs@m.gmane.org; Sun, 27 Nov 2005 13:51:46 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EgRcY-00014d-Rm for help-gnu-emacs@gnu.org; Sun, 27 Nov 2005 13:51:30 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EgRcW-00013e-UA for help-gnu-emacs@gnu.org; Sun, 27 Nov 2005 13:51:30 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EgRcW-00013W-QR for help-gnu-emacs@gnu.org; Sun, 27 Nov 2005 13:51:28 -0500 Original-Received: from [81.228.8.164] (helo=pne-smtpout2-sn2.hy.skanova.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EgRcW-000745-UH for help-gnu-emacs@gnu.org; Sun, 27 Nov 2005 13:51:29 -0500 Original-Received: from rocksteady.printf.se (81.224.154.131) by pne-smtpout2-sn2.hy.skanova.net (7.2.060.1) id 4384D4DB00194441; Sun, 27 Nov 2005 19:51:27 +0100 Original-Received: by rocksteady.printf.se (Postfix, from userid 1000) id A17963F97; Sun, 27 Nov 2005 19:51:27 +0100 (CET) Original-To: "Drew Adams" In-reply-to: X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:31421 Archived-At: > From: "Drew Adams" > 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.