>>>> "Joël" == Joël GRONDIN
<jgrondin(a)coframi-massy.com> writes:
Joël> Does a such mode exists, and if not, is it difficult to do ?
Emacs widgets (widget.el and related) do this. They are the
foundation of the Customize user interface. However, they don't know
how to parse a buffer and put r/o properties on it; they insert r/o
text into the buffer, interspersed with input regions.
Joël> Does mmm-mode can be used in this case ?
If you have a mode which parses the buffer for you, such as mmm mode,
and exposes the extents, overlays, or regions to other Lisp programs,
you just figure out which extents [regions] should be readonly and set
the readonly text property there using `(set-extent-property extent
'read-only t)' [`(add-text-properties start end '(read-only t))'].
You could also have a trivial `read-only' mode which makes the whole
buffer read-only, and use mmm-mode (in fact, you could just put
`toggle-read-only' on mmm-mode's hooks I suspect), but this could have
surprising results. For example, it is possible to write functions
which change arbitrary regions of text (ie, not containing point)
without moving point. With this strategy, such functions would work
just as well on "read-only" regions as long as point is in a
read-write region.
--
Institute of Policy and Planning Sciences
http://turnbull.sk.tsukuba.ac.jp
University of Tsukuba Tennodai 1-1-1 Tsukuba 305-8573 JAPAN
My nostalgia for Icon makes me forget about any of the bad things. I don't
have much nostalgia for Perl, so its faults I remember. Scott Gilbert c.l.py