Subject: bug#69259: 30.0.50; (get-pos-property 9483 'cursor-intangible) gives args-out-of-range error in folded magit buffer

From: Jonas Bernoulli <[email-masked]>
Date: Thu, 22 Feb 2024 16:17:06 +0100

StrawberryTea <[email-masked]> writes:

> Thanks for the explanation Stefan and Eli. I ended up making a PR to magit. And
> I think Tarsius is going to merge it. He just asked me to test it after he made
> a small change.

It would have helped me if you had mentioned this discussion there.
I only became aware of this because Eli cced me.  It is useful for
me because it confirms some speculation of mine.  When I merged the
Magit pull-request I mentioned that I am doing so as a quick fix for
the issue, but that I intend to look at it again at a later time.

>>> I think cursor-sensor is written under the assumption that the
>>> selected window’s buffer is also the current buffer, and if so,
>>> magit-post-command-hook should abide by that protocol.  Stefan, am I
>>> right?
>>
>> Not `cursor-sensor.el` in its entirety, but
>> `cursor-sensor-move-to-tangible` presumes that it is called with the
>> current-buffer already set to (window-buffer window).

That was my guess.  The merged commit just forgoes calling that function
if things aren't as expected.  My plan was (and obviously still is) to
look into instead ensuring that the expected buffer is current, making
it current if necessary.

     Jonas