Subject: bug#71370: 30.0.50; Please un-obsolete buffer-substring as a generalized variable

From: Michael Heerdegen <[email-masked]>
Date: Mon, 03 Mar 2025 09:32:57 +0100

Stefan Kangas <[email-masked]> writes:

> As for `buffer-substring`, if we can't have a function that provides
> that functionality (the proposed `replace-region`), then (setf
> (buffer-substring ...) ...) is clearly _not_ obsolete and shouldn't be
> marked as such.

This is a problem, yes (note we at least have `replace-region-contents'
in subr-x.el, though it's not exactly the same).

> FWIW, I don't see a huge need for a replacement function, and I think
> a generalized variable is perfectly serviceable in that case.

I don't, it's absolutely not, in my opinion.  This point had been
discussed somewhere above in this thread.  Short summary of my position:
the semantics of a generalized variable here is undefined, too unclear,
because there are already several, fundamentally different ways to
fulfill the contract "the place expression evals to the assigned value
after setting it": replacing text, inserting text and move what was
there after the inserted text, etc.  It is unclear what happens to
markers, overlays etc etc.  And all the difficulties that were hindering
Stefan to finish his version come on top - we just didn't discuss them
_here_.  `buffer-substring' was one of the worst generalized variables
that had been obsoleted.  The documentation doesn't tell anything about
how the setter behaves.  It's simply not existent.  Really bad,
actually, please don't get blinded by the lack of documentation and
discussion.

Let's better please wait for Stefan.  I'm sure that what he has is
already much much better than the simplistic setter we have.  I hope he
continues.  And if he doesn't, we still would have to go on with his
approach.

Michael.