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: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Eli Zaretskii <eliz <at> gnu.org>, Jonas Bernoulli <jonas <at> bernoul.li>, 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: Thu, 22 Feb 2024 11:15:28 -0600
[Message part 1 (text/plain, inline)]
Ok. I was looking at:

(defun view-echo-area-messages ()
  “View the log of recent echo-area messages: the `*Messages*’ buffer.
The number of messages retained in that buffer is specified by
the variable `message-log-max’.”
  (interactive)
  (with-current-buffer (messages-buffer)
    (goto-char (point-max))
    (let ((win (display-buffer (current-buffer))))
      ;; If the buffer is already displayed, we need to forcibly set
      ;; the window point to scroll to the end of the buffer.
      (set-window-point win (point))
      win)))

and it’s an example of a function which updates the window-buffer but not the
current-buffer. When I look at the C code for set-window-point, it explicitly
restores the current-buffer to the state it was in before the call. So overall,
this function pops messages-buffer up but will activate the post-command-hook
for the buffer that was current before the call.

I’m not sure if this is a bug or not, but it’s definitely an edge case that
catches a lot of packages off guard.

Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

>> 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.
>
> As alluded to in my other message, maybe we should consider it a bug
> if `post-command-hook` functions get called with (current-buffer)
> different from (window-buffer) and similarly I’d consider it a bug if
> such a function breaks this invariant.
>
> [ Just putting this out there, hoping to influence who you
>   blame at the end of your “look into” 🙂  ]
>
>         Stefan

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.