From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.help Subject: Re: Indentation in derived modes? Date: Wed, 15 Oct 2003 17:46:36 GMT Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1066241379 13835 80.91.224.253 (15 Oct 2003 18:09:39 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 15 Oct 2003 18:09:39 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Oct 15 20:09:37 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1A9q5Z-0003KL-00 for ; Wed, 15 Oct 2003 20:09:37 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1A9q4x-0002s7-GQ for geh-help-gnu-emacs@m.gmane.org; Wed, 15 Oct 2003 14:08:59 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!in.100proofnews.com!in.100proofnews.com!snoopy.risq.qc.ca!charlie.risq.qc.ca!53ab2750!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 40 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 Original-NNTP-Posting-Host: 132.204.24.42 Original-X-Complaints-To: abuse@umontreal.ca Original-X-Trace: charlie.risq.qc.ca 1066239996 132.204.24.42 (Wed, 15 Oct 2003 13:46:36 EDT) Original-NNTP-Posting-Date: Wed, 15 Oct 2003 13:46:36 EDT Original-Xref: shelby.stanford.edu gnu.emacs.help:117278 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:13207 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:13207 > I'm looking at various templating systems for embedding some > kind of programming code within HTML, and would like Emacs to > handle this as best as possible. It seems that basing it on an > HTML-type mode, like psgml-mode (which seems only to indent if > there's a DTD included, which may not always be the case if > you're using templates) or html-helper-mode (does that indent, > for that matter? I haven't used it), would be the way to start, > and then adding to it some functionality for indenting the > template's statements. Is that possible, or would I have to > redo the entire indentation code to accommodate the possibility > of embedded non-HTML statements? Is this a particularly difficult > programming task? Indentation is the only part of a major mode that requires thinking, meaning that it can be pretty tricky and there's no accepted standard way of solving the problem. I.e. indenting can be tricky. You might want to look into mmm-mode (on sourceforge) which tries to solve the problem of multiple-major-modes in a single buffer and arrange to use the proper indentation code for the corresponding zone of a buffer. It's a difficult problem, so I recommend you try to use other people's work before embarking on your own attempt. Also, if mmm-mode doesn't work well enough, it would be better to fix mmm-mode (or the modes with which it interacts). > Any pointers to tutorials for writing such code would also > be appreciated! There wasn't anything on it in a few of the > things I've looked at already. I only know of one person who tried to describe how he wrote his indentation code. And sadly it's an approach that tends to have serious limitations. http://www.emacswiki.org/cgi-bin/wiki/ModeTutorial Hopefully some day things will be better. Stefan