unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: StrawberryTea <look@strawberrytea.xyz>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Eli Zaretskii <eliz@gnu.org>, Jonas Bernoulli <jonas@bernoul.li>,
	69259@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	[thread overview]
Message-ID: <87wmqwbdvk.fsf@strawberrytea.xyz> (raw)
In-Reply-To: <jwv8r3cpll7.fsf-monnier+emacs@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 1770 bytes --]

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@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

      reply	other threads:[~2024-02-22 17:15 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-18 21:08 bug#69259: 30.0.50; (get-pos-property 9483 'cursor-intangible) gives args-out-of-range error in folded magit buffer StrawberryTea
2024-02-19 12:27 ` Eli Zaretskii
2024-02-20 15:42   ` StrawberryTea
2024-02-21 12:31     ` Eli Zaretskii
2024-02-21 14:30       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-02-21 23:29         ` StrawberryTea
2024-02-22  6:42           ` Eli Zaretskii
2024-02-22 15:17           ` Jonas Bernoulli via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-02-22 15:30             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-02-22 17:15               ` StrawberryTea [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87wmqwbdvk.fsf@strawberrytea.xyz \
    --to=look@strawberrytea.xyz \
    --cc=69259@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=jonas@bernoul.li \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).