[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Tracking buffer positions across time, without markers (was Re: PL s
From: |
Stefan Monnier |
Subject: |
Re: Tracking buffer positions across time, without markers (was Re: PL support) |
Date: |
Sun, 10 May 2020 16:46:29 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
> The general problem is this: I send the contents of a buffer to
> a subprocess. Some time later, the subprocess returns a list of positions
> (offsets from the beginning of the buffer, or line/column pairs, etc).
> At that point, these positions may be stale, since the contents of the
> buffer may have changed. I need a way to translate these positions
> (relative to the old buffer contents) into positions relative to the new
> buffer contents.
As you said you should be able to use the undo-list for that.
It'll require a bit of work, but hopefully that can be used in
several places, justifying the investment.
If you have the option to ask for a more up-to-date version of the data
to be sent, you can obviously throw the data away, but even in that case
you should be able to do better with fairly little work: use an
after-change-function to keep track of just 2 markers that indicate the
beginning and end of the part of the buffer that's been modified.
Then you can easily translate all the positions before the first and
after the second marker and only discard the data between the two.
Stefan
- Re: Tracking buffer positions across time, without markers (was Re: PL support), (continued)
- Re: Tracking buffer positions across time, without markers (was Re: PL support), João Távora, 2020/05/09
- Re: Tracking buffer positions across time, without markers (was Re: PL support), Clément Pit-Claudel, 2020/05/09
- Re: Tracking buffer positions across time, without markers (was Re: PL support), Eli Zaretskii, 2020/05/10
- Re: Tracking buffer positions across time, without markers (was Re: PL support), Clément Pit-Claudel, 2020/05/10
- RE: Tracking buffer positions across time, without markers (was Re: PL support), Drew Adams, 2020/05/10
- Re: Tracking buffer positions across time, without markers (was Re: PL support), Eli Zaretskii, 2020/05/10
- Re: Tracking buffer positions across time, without markers (was Re: PL support), Clément Pit-Claudel, 2020/05/10
- Re: Tracking buffer positions across time, without markers (was Re: PL support), Eli Zaretskii, 2020/05/11
- Re: Tracking buffer positions across time, without markers (was Re: PL support), Clément Pit-Claudel, 2020/05/11
- Re: Tracking buffer positions across time, without markers (was Re: PL support), Stefan Monnier, 2020/05/11
- Re: Tracking buffer positions across time, without markers (was Re: PL support),
Stefan Monnier <=
- Re: Tracking buffer positions across time, without markers (was Re: PL support), Eli Zaretskii, 2020/05/10
- Re: Tracking buffer positions across time, without markers (was Re: PL support), Stefan Monnier, 2020/05/10
- Re: Tracking buffer positions across time, without markers (was Re: PL support), Vladimir Sedach, 2020/05/10
- Re: Tracking buffer positions across time, without markers (was Re: PL support), Clément Pit-Claudel, 2020/05/11
- Re: Tracking buffer positions across time, without markers (was Re: PL support), João Távora, 2020/05/11
- Re: Tracking buffer positions across time, without markers (was Re: PL support), Clément Pit-Claudel, 2020/05/11
- Re: Tracking buffer positions across time, without markers (was Re: PL support), João Távora, 2020/05/11
- Re: Tracking buffer positions across time, without markers (was Re: PL support), Clément Pit-Claudel, 2020/05/11
- Re: Tracking buffer positions across time, without markers (was Re: PL support), João Távora, 2020/05/11
- Re: Tracking buffer positions across time, without markers (was Re: PL support), Stefan Monnier, 2020/05/11