From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Herbert Euler" Newsgroups: gmane.emacs.devel Subject: Indentation problem in corporating major modes Date: Mon, 28 Nov 2005 12:39:31 +0800 Message-ID: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; format=flowed X-Trace: sea.gmane.org 1133152834 1347 80.91.229.2 (28 Nov 2005 04:40:34 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 28 Nov 2005 04:40:34 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Nov 28 05:40:31 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1Egao2-0001ec-7Z for ged-emacs-devel@m.gmane.org; Mon, 28 Nov 2005 05:39:58 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Egao1-0005Al-L3 for ged-emacs-devel@m.gmane.org; Sun, 27 Nov 2005 23:39:57 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Eganf-00055X-2w for emacs-devel@gnu.org; Sun, 27 Nov 2005 23:39:35 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Egand-00054p-8l for emacs-devel@gnu.org; Sun, 27 Nov 2005 23:39:34 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Egand-00054k-16 for emacs-devel@gnu.org; Sun, 27 Nov 2005 23:39:33 -0500 Original-Received: from [64.4.26.38] (helo=hotmail.com) by monty-python.gnu.org with esmtp (Exim 4.34) id 1Egand-0001mi-0X for emacs-devel@gnu.org; Sun, 27 Nov 2005 23:39:33 -0500 Original-Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Sun, 27 Nov 2005 20:39:31 -0800 Original-Received: from 64.4.26.200 by by112fd.bay112.hotmail.msn.com with HTTP; Mon, 28 Nov 2005 04:39:31 GMT X-Originating-IP: [202.43.217.195] X-Originating-Email: [herberteuler@hotmail.com] X-Sender: herberteuler@hotmail.com Original-To: emacs-devel@gnu.org X-OriginalArrivalTime: 28 Nov 2005 04:39:31.0745 (UTC) FILETIME=[B99AF110:01C5F3D5] X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:46680 Archived-At: Hello everyone, Please take a look at this to see how to solve the indentation problem. There are several major modes in the standard Emacs, each of them consists of several customizations e.g. indentation, syntax highlighting etc. Major modes are exclusive to each other, so only one major mode can be active at one time. Indentation in one major mode works fine in this way. Multiple Major Mode, which is also called mmm-mode, is a minor mode that can glue several major modes together. In mmm-mode, there is one primary major mode, plus several submodes. While the point is in a submode region, Emacs behaves like in the major mode of that submode. This is pretty useful when editing files contain content should be identified as different kinds of text, such as CGI scripts, since this approach make existing work on different progmodes work together, instead of creating new major modes. Take the PHP file as example. Typically, a PHP file contains content like this:

Content between "" is PHP program, the other is HTML tags. The advantage of mmm-mode is that one can combine these two major modes without creating a new major mode trying to deal with file contains both HTML tags and PHP code. And more major modes could be involved in with little effort than creating new ones. But the indentation is not fine in now. The PHP code is better indented beyond "

" in the above example than indented to column 0. But in the current mmm-mode, PHP code will be indented from column 0. So the code in the above example will be indented like this:

This is more difficult to read than the former one. Tracing the indentation code, I found it might be because all progmodes use the function 'indent-to' to indent, and that command count from column 0. This is fine in a single major mode, but is a bit worse when several major modes corporate with each other in mmm-mode. I found lots of progmodes count by using 'beginning-of-line', so I asked a question in help-gnu-emacs about stopping 'beginning-of-line' beyond column 0, and was told to solve this problem with field property. 'Beginning-of-line' indeed stops at the field boundary, but indentation is not affected in my test of setting field property for some text in a program. So perhaps 'indent-to' should be modified? Because modifying all progmodes is really so difficult, I think it is easier and better to modify the 'indent-to' command, so that it supports indent from columns other than column 0. I'm not sure whether it's a good approach, so I post this message. Please give me some suggestions, thanks very much. Regards, Guanpeng Xu _________________________________________________________________ FREE pop-up blocking with the new MSN Toolbar - get it now! http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/ From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Herbert Euler" Newsgroups: gmane.emacs.devel Subject: RE: Indentation problem in corporating major modes Date: Thu, 01 Dec 2005 10:21:06 +0800 Message-ID: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; format=flowed X-Trace: sea.gmane.org 1133403760 12785 80.91.229.2 (1 Dec 2005 02:22:40 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 1 Dec 2005 02:22:40 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Dec 01 03:22:38 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1Ehe4g-0005bR-7U for ged-emacs-devel@m.gmane.org; Thu, 01 Dec 2005 03:21:30 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ehe4f-00011l-LM for ged-emacs-devel@m.gmane.org; Wed, 30 Nov 2005 21:21:29 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Ehe4M-00011I-CL for emacs-devel@gnu.org; Wed, 30 Nov 2005 21:21:10 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Ehe4K-000114-Qm for emacs-devel@gnu.org; Wed, 30 Nov 2005 21:21:10 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ehe4K-000111-KP for emacs-devel@gnu.org; Wed, 30 Nov 2005 21:21:08 -0500 Original-Received: from [64.4.26.23] (helo=hotmail.com) by monty-python.gnu.org with esmtp (Exim 4.34) id 1Ehe4K-00044o-Ek for emacs-devel@gnu.org; Wed, 30 Nov 2005 21:21:08 -0500 Original-Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Wed, 30 Nov 2005 18:21:06 -0800 Original-Received: from 64.4.26.200 by by112fd.bay112.hotmail.msn.com with HTTP; Thu, 01 Dec 2005 02:21:06 GMT X-Originating-IP: [202.43.217.195] X-Originating-Email: [herberteuler@hotmail.com] X-Sender: herberteuler@hotmail.com Original-To: emacs-devel@gnu.org X-OriginalArrivalTime: 01 Dec 2005 02:21:06.0279 (UTC) FILETIME=[E266A770:01C5F61D] X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:46841 Archived-At: I saw the following in etc/TODO: >** Implement a clean way to use different major modes for > different parts of a buffer. This could be useful in editing > Bison input files, for instance, or other kinds of text > where one language is embedded in another language. What does clean mean here? Is mmm-mode not clean enough? Regards, Guanpeng Xu _________________________________________________________________ Don't just search. Find. Check out the new MSN Search! http://search.msn.com/ From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Kastrup Newsgroups: gmane.emacs.devel Subject: Re: Indentation problem in corporating major modes Date: Thu, 01 Dec 2005 12:09:54 +0100 Message-ID: <854q5tgjjx.fsf@lola.goethe.zz> References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1133443155 26095 80.91.229.2 (1 Dec 2005 13:19:15 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 1 Dec 2005 13:19:15 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Dec 01 14:19:13 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EhoJz-0007UX-EA for ged-emacs-devel@m.gmane.org; Thu, 01 Dec 2005 14:17:59 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EhoJy-000876-Ac for ged-emacs-devel@m.gmane.org; Thu, 01 Dec 2005 08:17:58 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EhnUd-0000Cl-2Y for emacs-devel@gnu.org; Thu, 01 Dec 2005 07:24:55 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EhnT1-0007T9-3y for emacs-devel@gnu.org; Thu, 01 Dec 2005 07:23:15 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ehmtt-00065Z-KY for emacs-devel@gnu.org; Thu, 01 Dec 2005 06:46:58 -0500 Original-Received: from [199.232.76.164] (helo=fencepost.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.34) id 1Ehmtt-00046j-Sr for emacs-devel@gnu.org; Thu, 01 Dec 2005 06:46:57 -0500 Original-Received: from localhost ([127.0.0.1] helo=lola.goethe.zz) by fencepost.gnu.org with esmtp (Exim 4.34) id 1Ehmts-0007oJ-OA; Thu, 01 Dec 2005 06:46:57 -0500 Original-Received: by lola.goethe.zz (Postfix, from userid 1002) id E41481D59820; Thu, 1 Dec 2005 12:09:54 +0100 (CET) Original-To: "Herbert Euler" In-Reply-To: (Herbert Euler's message of "Thu, 01 Dec 2005 10:21:06 +0800") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:46851 Archived-At: "Herbert Euler" writes: > I saw the following in etc/TODO: > >>** Implement a clean way to use different major modes for >> different parts of a buffer. This could be useful in editing >> Bison input files, for instance, or other kinds of text >> where one language is embedded in another language. > > What does clean mean here? Is mmm-mode not clean enough? For one thing, it is not an integral part of Emacs. For another, it does not keep indentation, syntax coloring and similar separate for chunks of different languages. From the time I tried applying it to my problems I seem to remember that it did not provide clean hooks for adding new language combinations. As a very simple example, take the code at . Can you coax mmm-mode into a mode of working where it will maintain proper indentation across all corresponding C snippets and do paren matching and stuff only for the C parts as long as you are in the C sections? That's what would be required for editing this sort of thing. Basically, things like syntax tables and modes would need to be specifiable by overlays or text properties, and one would need a way to tie physically apart parts in one language together for the purpose of syntactical matching and indentation. -- David Kastrup, Kriemhildstr. 15, 44793 Bochum From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Richard M. Stallman" Newsgroups: gmane.emacs.devel Subject: Re: Indentation problem in corporating major modes Date: Thu, 01 Dec 2005 21:07:20 -0500 Message-ID: References: Reply-To: rms@gnu.org NNTP-Posting-Host: main.gmane.org Content-Type: text/plain; charset=ISO-8859-15 X-Trace: sea.gmane.org 1133489580 19629 80.91.229.2 (2 Dec 2005 02:13:00 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 2 Dec 2005 02:13:00 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Dec 02 03:12:52 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1Ei0Oy-0002ne-RC for ged-emacs-devel@m.gmane.org; Fri, 02 Dec 2005 03:11:57 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ei0L2-0007sd-HY for ged-emacs-devel@m.gmane.org; Thu, 01 Dec 2005 21:07:52 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Ei0Kg-0007qi-DX for emacs-devel@gnu.org; Thu, 01 Dec 2005 21:07:30 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Ei0KX-0007lv-TP for emacs-devel@gnu.org; Thu, 01 Dec 2005 21:07:25 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ei0KX-0007lH-3x for emacs-devel@gnu.org; Thu, 01 Dec 2005 21:07:21 -0500 Original-Received: from [199.232.76.164] (helo=fencepost.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.34) id 1Ei0KW-0003ED-L6 for emacs-devel@gnu.org; Thu, 01 Dec 2005 21:07:20 -0500 Original-Received: from rms by fencepost.gnu.org with local (Exim 4.34) id 1Ei0KW-0007qs-55; Thu, 01 Dec 2005 21:07:20 -0500 Original-To: "Herbert Euler" In-reply-to: (herberteuler@hotmail.com) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:46870 Archived-At: What does clean mean here? Is mmm-mode not clean enough? I don't know. What does mmm-mode do? What are its limitations? Would the developers sign copyright assignments for it? From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Herbert Euler" Newsgroups: gmane.emacs.devel Subject: RE: Indentation problem in corporating major modes Date: Fri, 02 Dec 2005 10:33:05 +0800 Message-ID: References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; format=flowed X-Trace: sea.gmane.org 1133490835 22308 80.91.229.2 (2 Dec 2005 02:33:55 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 2 Dec 2005 02:33:55 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Dec 02 03:33:47 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1Ei0jo-0000Uo-3j for ged-emacs-devel@m.gmane.org; Fri, 02 Dec 2005 03:33:28 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ei0jn-0007BN-8r for ged-emacs-devel@m.gmane.org; Thu, 01 Dec 2005 21:33:27 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Ei0jZ-00078G-E7 for emacs-devel@gnu.org; Thu, 01 Dec 2005 21:33:13 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Ei0jX-00076f-Jm for emacs-devel@gnu.org; Thu, 01 Dec 2005 21:33:13 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ei0jX-00076a-Fm for emacs-devel@gnu.org; Thu, 01 Dec 2005 21:33:11 -0500 Original-Received: from [64.4.26.16] (helo=hotmail.com) by monty-python.gnu.org with esmtp (Exim 4.34) id 1Ei0jX-0005cI-E8 for emacs-devel@gnu.org; Thu, 01 Dec 2005 21:33:11 -0500 Original-Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Thu, 1 Dec 2005 18:33:06 -0800 Original-Received: from 64.4.26.200 by by112fd.bay112.hotmail.msn.com with HTTP; Fri, 02 Dec 2005 02:33:05 GMT X-Originating-IP: [202.43.217.195] X-Originating-Email: [herberteuler@hotmail.com] X-Sender: herberteuler@hotmail.com In-Reply-To: Original-To: emacs-devel@gnu.org X-OriginalArrivalTime: 02 Dec 2005 02:33:06.0081 (UTC) FILETIME=[B9D97910:01C5F6E8] X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:46872 Archived-At: I now realize the critical point in this problem. Before solving it, I must be familiar with how Emacs indents, how major modes work, how mmm-mode works, and probably many other things. This will take time, but I'll try my best. Mmm-mode is an extension of Emacs, the homepage of mmm-mode is http://mmm-mode.sourceforge.net/ , and it distributes with GNU GPL. Mmm-mode is a minor mode for Emacs which allows Multiple Major Modes to coexist in a single buffer. Regards, Guanpeng Xu _________________________________________________________________ Don't just search. Find. Check out the new MSN Search! http://search.msn.com/