unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
Subject: Re: Indentation in derived modes?
Date: Wed, 15 Oct 2003 17:46:36 GMT	[thread overview]
Message-ID: <jwvllrm2yqe.fsf-monnier+gnu.emacs.help@vor.iro.umontreal.ca> (raw)
In-Reply-To: bmjn7c$p1d$1@panix2.panix.com

> 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

      parent reply	other threads:[~2003-10-15 17:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-15 14:56 Indentation in derived modes? Jesse Sheidlower
2003-10-15 17:10 ` Peter Lee
2003-10-15 17:46 ` Stefan Monnier [this message]

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=jwvllrm2yqe.fsf-monnier+gnu.emacs.help@vor.iro.umontreal.ca \
    --to=monnier@iro.umontreal.ca \
    /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).