Subject: Re: bug#79200: 31.0.50; Duplicated elements for '#<marker at' in buffer-undo-list

From: Gerd Möllmann <[email-masked]>
Date: Wed, 13 Aug 2025 10:37:49 +0200

Alan Mackenzie <[email-masked]> writes:

>> BTW, C-h v next--marker-id and 'g' to refresh is somwwhat interesting.
>> In my mac GUI session each 'g' shows 472 markers have been made.
>> Whatever that means.

Hi Alan.

> That sounds a lot, but ....  many of these markers will have a short
> lifetime, being rapidly terminated with (set-marker foo nil) or the
> like.

One would hope so, yes :-).

> What matters more is surely the number of markers which persist and can
> get into buffer-undo-list.  In your current version, have you built my
> function buffer-marker-list into it?  M-: (length (buffer-marker-list))
> is revealing.  Currently when I run that form repeatedly, I'm getting an
> extra 3 markers per repetition.  That's in my version which takes care to
> eliminate markers as soon as possible after they're not needed.

No, I don't have your function. Reason is that there are currently 3
implementations of BUF_MARKERS, and porting to all the variants was to
much for me, ATM.

(1) in mainstream BUF_MARKERS is a list

(2) in igc it's a "marker array"

(3) in my Emacs it's a different kind of marker array. That's because
    Stef asked if I could port the marker array from (2) to mainstream,
    and that ended up also with a different marker implementation. That
    I ported back to mainstream in feature/text-index, text-index.[ch]
    and marker-array.[ch]. Don't know what Stef's plans are wrt to that.

It's complicated ;-).