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

From: Eli Zaretskii <[email-masked]>
Date: Mon, 19 Feb 2024 14:27:36 +0200

> From: StrawberryTea <[email-masked]>
> Date: Sun, 18 Feb 2024 15:08:20 -0600
> 
> Hi. So I noticed that sometimes magit-section-post-command-hook was giving an
> ars-out-of-range error and I have narrowed it down to a C function in Emacs:
> 
> Debugger entered--Lisp error: (args-out-of-range 9482 9482)
> cursor-sensor--intangible-p(9483)
> cursor-sensor-tangible-pos(9483 #<window 3 on magit: emacs>)
> cursor-sensor-move-to-tangible(#<window 3 on magit: emacs>)
> #<subr magit-section-post-command-hook>()
> apply(#<subr magit-section-post-command-hook> nil)
> (condition-case err (apply func args) ((debug error) (signal (car err) (cdr err))))
> cae-debug-reraise-error(#<subr magit-section-post-command-hook>)
> apply(cae-debug-reraise-error #<subr magit-section-post-command-hook> nil)
> magit-section-post-command-hook()
> 
> Within cursor-sensor--intangible-p, (get-pos-property 9483 'cursor-intangible)
> is giving that error in the Magit buffer even though that 9483 number is less
> than (point-max).

Can you show a recipe to reproduce this, preferably without using
Magit?

I suspect some code narrows the buffer while this code runs, which is
why the error is signaled.