unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Indentation in derived modes?
@ 2003-10-15 14:56 Jesse Sheidlower
  2003-10-15 17:10 ` Peter Lee
  2003-10-15 17:46 ` Stefan Monnier
  0 siblings, 2 replies; 3+ messages in thread
From: Jesse Sheidlower @ 2003-10-15 14:56 UTC (permalink / raw)



I'm relatively new to the actual writing of Emacs Lisp, but
I'd like to figure out whether it would be possible [i.e. for
me] to get indentation working for a derived mode.

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?

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.

Thanks very much.

Jesse Sheidlower

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Indentation in derived modes?
  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
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Lee @ 2003-10-15 17:10 UTC (permalink / raw)


>>>> Jesse Sheidlower writes:

    Jesse> I'd like to figure out whether it would be possible
    Jesse> [i.e. for me] to get indentation working for a derived
    Jesse> mode.

    Jesse> Any pointers to tutorials for writing such code would also
    Jesse> be appreciated!

http://www.emacswiki.org/cgi-bin/wiki/CategoryCode might help.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Indentation in derived modes?
  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
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Monnier @ 2003-10-15 17:46 UTC (permalink / raw)


> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-10-15 17:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 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).