I've toyed with this idea, too, but not that ambitiously.
I've thought more along the lines of "paste last line," which i used to
do with OS macros in word 4.0 and 5.1, and "save this line as a diff to
the last line," so changes would be inheritted.
In terms of linking, it might be possible to cannibalize parts of the
mailmerge code, though this would mean it wouldn't be interactive (i
think, though i suppose it could be triggered).
which led me to some more thinking, and I suddenly realized that adding
the demotion/promotion of header levels, including subsidiary levels,
is almost a triviality (and as usual, some documents with, uhh,
uninspired inconsistancies, had a lot to do with this).
Once I can get 1.1 to make, I'll give it a try. It comes to
demotethis() {
if ! aHeaderStyle(thisParagraph) abort;
if (headerlevel(thisParagraph) == maxlevel) abort;
thisparagraph.headerlevel--;
}
and
demote() {
<same first to>
startlevel=headerlevel(thisparagaph);
thisparagraph.demotethis();
thisparagraph -> thisparagraph.nextpar()
while (headerlevel(thisparagraph)) < startlevel) {
thisparagraph.demotethis();
thisparagraph -> thisparagraph.nextpar();
}
and similarly for promote.
ANd there's more :)
I'd also been thinking of sorting the merge records in a buffer. With
the nextpar()/lastpar(), this is fairly easy. But it also means that
we can group paragraphs by header level to drag them around in the
table of contents.
WHich is the tough part :) I have no clue how to read the key/mouse events
in the table of contents. BUt knowing the beginning/end of the drag
events, i now see how to make the move within the text.
rick
--