Subject: bug#17893: 24.4.50; (error "Marker does not point anywhere")

From: Eli Zaretskii <[email-masked]>
Date: Sun, 26 Nov 2017 18:07:40 +0200

> Date: Sun, 26 Nov 2017 11:26:29 +0100
> From: martin rudalics <[email-masked]>
> CC: [email-masked], [email-masked]
> 
>  > What is missing is a way of methodically walking all the markers
>  > reachable from the cloned buffer's local variables, and changing each
>  > marker to point to the cloned buffer instead of the parent buffer.
> 
> Have `clone-buffer' record the parent buffer somewhere and when we
> encounter a marker referring a dead buffer that is the same as the
> recorded parent buffer redirect the marker on the fly to the cloned
> buffer.  Not overly clean but what could we lose?

When a buffer is deleted, all the markers that point to it get their
buffer wiped out, so I think the above method cannot work, unless you
replace all NULL buffer pointers with the cloned buffer -- which will
probably be too much.

And remember that markers without any buffer do not get adjusted, so
their position will quickly become incorrect or even outside the
cloned buffer's text, and then such markers will become useless.  So
we cannot delay this until the marker is accessed by some Lisp.