Glad to see your face again, Karl!
psu25682(a)odin.cc.pdx.edu (Karl M. Hegbloom) writes:
I've thought about that a little bit... Someone else posted
about
something like this a while ago also. You'd have to have "extent
local" modes to do that, he thought, with different sets of
extent-local variables for font-locking and suchlike to work inside
those tags. Extents already have their own keymap, so you can
bind, for instance, a different indenter function to TAB, only
inside that extent.
I thought about this some time ago, and I must say I don't like this
solution. While it's true that Emacs Lisp is already divergent from
any other Lisp, adding extent-local variables would add new meaning to
the notion of divergence.
In Lisp, the value of a variable should be just that. In Emacs Lisp,
we have these things called "buffer-local variables", which are an
abomination from the lispy point of view, but awfully useful in
practice. Horrible kludges exist to implement such things, and
upgrading that mechanism to be extent-specific is IMHO not a good
idea.
Note that extent-local keymaps are perfectly fine because "keymap" is
already an Emacs-only notion which carries all kinds of magic with
it. If that magic is extent-local, that's just fine. Not so with
variables.
You could then make a mode for your .jsp files that wrapped an
extent
around the Java part, giving that it's own set of keybindings. Over
the whole buffer then, you'd need your own set of font-lock-keywords,
that can handle both the HTML part and the Java part.
We already have that, sort of. In XEmacs, font-lock regexps are a
property of the major mode symbol. This means that in the future, an
intelligent font-locker can just look at the major mode in an extent
and apply its font-lock regexps there.
There is also a thing called an indirect buffer... You can make an
indirect buffer of a buffer, and put that into a different mode.
That works, but then you have to use narrowing -- there's no way to
create an indirect buffer out of a *part* of a buffer's contents.
And ultimately, the indirect buffer solution is suboptimal because it
entails using a separate buffer in a separate window, which is not
what the user wants. In this case, indirect buffers are merely a
kludge to work around implementation deficiencies.
I need to go eat then do my math.
Good luck!