emacs-devel
[Top][All Lists]
Advanced

[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: Vladimir Sedach
Subject: Re: Tracking buffer positions across time, without markers (was Re: PL support)
Date: Sun, 10 May 2020 17:17:10 -0700
User-agent: mu4e 1.3.10; emacs 26.2

Clément Pit-Claudel <address@hidden> writes:
> Since we don't know beforehand what positions the subprocess will
> return, I don't think markers can help; right?

It sounds like the fundamental thing you need here is a function from
the integers 1 to point-max of the buffer as it was when you sent
its contents to the sub-process, to the integers 1 to point-max of
the buffer as it is when the sub-process returns some results.

One naive way to obtain this function is to "snapshot" the buffer by
assigning every character in the buffer a text property with the
value of its position at the time of the snapshot.

A refinement would be to put the text property on tokens. Sticky text
properties would do the right thing when changing identifier names.

Another refinement is to use Stefan's idea of delimiting unmodified
intervals and only add properties in the modified interval.

Text properties are nice because they follow kill/yank. Markers do
not. A problem is that text properties are wiped away by
replace-string and similar.

I can see this displaying confusing and nonsensical results if there
are a lot of edits in the time it take the sub-process to return.

--
Vladimir Sedach
Software engineering services in Los Angeles https://oneofus.la



reply via email to

[Prev in Thread] Current Thread [Next in Thread]