[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Advice on how to save/restore editor buffers
- To: Henry%MIT-OZ@MIT-MC, Bug-Zwei%MIT-OZ@MIT-MC
- Subject: Advice on how to save/restore editor buffers
- From: Daniel L. Weinreb <DLW%SCRC-TENEX@MIT-MC>
- Date: Mon ,4 Jul 83 10:15:00 EDT
- In-reply-to: The message of 1 Jul 83 11:13-EDT from Henry Lieberman <Henry at MIT-AI>
Date: Friday, 1 July 1983, 11:13-EDT
From: Henry Lieberman <Henry@MIT-OZ>
I would like to "save the state of the buffer" at some point,
then allow some editing operations, then later optionally
restore the saved state [edited text, point and mark].
A more extensive explanation of what it is you're trying to do
would be helpful, but I'll do my best without this information.
- Save the buffer by COPY-INTERVAL, POINT and MARK by
Well, depends on exactly what you're trying to do. But copy-bp will
create a second bp pointing into the same original buffer, not into
the copy produced by copy-interval. There really ought to be a way
to copy an interval and create analogous copied BPs with it, now that
you mention it; this never came up in Zwei's implementation so I never
- As above, but make strings instead and use indices into strings.
Well, given the lack of the facility I mentioned, yeah, this might
be the best way. There is a way to convert a BP into a numerical
index somewhere (I think m-X Revert uses this), and to go the other
way you can just use forward-char.
- In the case I don't change buffers, but some buffer text
has been edited, can I avoid save/restore on the buffer interval?
I don't understand this.
- When do I need MOVES type bp's vs. NIL type bp's?
There are three kinds: normal, moves, and nil. The nil kind do not
relocate when text is inserted or deleted; they are invalid after
an insert or delete has happened and should not be used, since they
might point into a deleted line, or off the end of a line. Normal
and moves relocate properly and are almost identical, the only
difference being what happens if text is inserted at exactly the
place that the BP points: normal ones end up before the inserted
text and moves ones end up after it.