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: Wed, 21 Feb 2024 17:29:54 -0600 [thread overview]
Message-ID: <87y1bdmlwa.fsf@strawberrytea.xyz> (raw)
In-Reply-To: <jwvcyspc338.fsf-monnier+emacs@gnu.org>
[-- Attachment #1: Type: text/plain, Size: 2325 bytes --]
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.
Sincerely,
StrawberryTea
modified lisp/magit-section.el
@@ -1635,10 +1635,14 @@ evaluated its BODY. Admittedly that’s a bit of a hack.“
(setq magit-section-pre-command-section (magit-current-section)))
(defun magit-section-post-command-hook ()
• (cursor-sensor-move-to-tangible (selected-window))
• (when (or magit–context-menu-buffer
• magit–context-menu-section)
• (magit-menu-highlight-point-section))
⁃ (let ((window (selected-window)))
⁃ ;; The command may have used `set-window-buffer’ to change
⁃ ;; the window’s buffer without changing the current buffer.
⁃ (when (eq (current-buffer) (window-buffer window))
⁃ (cursor-sensor-move-to-tangible window)
⁃ (when (or magit–context-menu-buffer
⁃ magit–context-menu-section)
⁃ (magit-menu-highlight-point-section))))
(unless (memq this-command ’(magit-refresh magit-refresh-all))
(magit-section-update-highlight)))
Stefan Monnier <monnier@iro.umontreal.ca> writes:
> Eli wrote:
>> 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).
>
> StrawberryTea wrote:
>> Why exactly are the window-buffer and the current-buffer different?
>
> Good question. AFAIK the code that runs `post-command-hook` normally
> tries to avoid such situations.
>
>> 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.
>
> Could be a “bad citizen” on `post-command-hook`, indeed, which messes up
> subsequent functions on the hook. Maybe the code that runs
> `post-command-hook` should be more careful to (re)set current-buffer
> after each function, but it seems easier to fix the rare functions which
> mess it up.
>
> Stefan
next prev parent reply other threads:[~2024-02-21 23:29 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 [this message]
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
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=87y1bdmlwa.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).