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: Clément Pit-Claudel
Subject: Re: Tracking buffer positions across time, without markers (was Re: PL support)
Date: Mon, 11 May 2020 12:02:02 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0

On 11/05/2020 11.44, João Távora wrote:
> Of course, the smart way is to use the buffer-undo-list.

High praise!

> Now I understand Stefan's suggestion. You should be able to record 
> the value of the variable buffer-undo-list into a variable at the
> time you make the request.  Then you need a function that, given that
> value OLD-BUL, a buffer position OLD, the new value of
> buffer-undo-list NEW-BUL and a thing called X,  gives you the current
> buffer position NEW where a marker of type X would have ended up if
> it had been set at OLD.

Thanks, but I think you're just explaining back my suggestion to me :) In my 
original email, I wrote "I've been thinking of building one for a while.  I 
think it can be done entirely in ELisp, by using the undo list: snapshots would 
be pointers into the undo list, and positions could be translated by iterating 
over all undo list entries between two snapshots and adjusting positions 
according to each undo-list entry."

> This is a nice elisp exercise, good for unit-testing with ert.  If
> you post it to emacs-help or reddit someone maybe someone will do the
> hard work for you (maybe a change from the general theme of
> indignation).

Oh, no worries, I'll probably get around to doing it if no one beats me to it :)



reply via email to

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