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

Previous Next

Package: emacs;

Reported by: StrawberryTea <look <at> strawberrytea.xyz>

Date: Sun, 18 Feb 2024 21:19:02 UTC

Severity: normal

Found in version 30.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: StrawberryTea <look <at> strawberrytea.xyz>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 69259 <at> debbugs.gnu.org
Subject: bug#69259: 30.0.50; (get-pos-property 9483 'cursor-intangible) gives args-out-of-range error in folded magit buffer
Date: Tue, 20 Feb 2024 09:42:36 -0600
[Message part 1 (text/plain, inline)]
Hi Eli. I inserted a print function into magit-post-command-hook:

(defadvice! cae-magit-section-post-command-hook-a (oldfun)
  :around #’magit-section-post-command-hook
  (condition-case e
      (funcall oldfun)
    (error
     (+log “magit-post-command-hook error:”
           (current-buffer) (selected-window) (buffer-narrowed-p) (point-min)
  (point-max) (buffer-size)))))

and it outputted this:
Values: magit-post-command-hook error:, magit: emacs, #<window 156 on
*Messages*>, nil, 1, 20993, 20992 Eli Zaretskii <eliz <at> gnu.org>

So basically, the situation is that the (current-buffer) is magit: emacs whereas
the window is on \*Messages\* and so when we call (get-pos-property pos
’cursor-intangible), it uses a point value from magit: emacs on the messages
buffer.

Why exactly are the window-buffer and the current-buffer different? I think this
has to do with persp-mode. My guess is that when it sets the new window
configuration, the current-buffer is not updated to the new window’s buffer
immediately.

Sincerely,
StrawberryTea

writes:

>> From: StrawberryTea <look <at> strawberrytea.xyz>
>> 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.

This bug report was last modified 1 year and 87 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.