Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check current buffer in magit-section-post-command-hook #5098

Merged

Conversation

LemonBreezes
Copy link
Contributor

@LemonBreezes LemonBreezes commented Feb 20, 2024

This commit addresses an issue where if you run a command like persp-switch which uses set-window-buffer, the current buffer is not updated which can cause magit-post-command-hook to emit an error.

@tarsius tarsius force-pushed the check-current-buffer-in-post-command-hook branch from 3551711 to 6b10040 Compare February 21, 2024 14:47
@tarsius
Copy link
Member

tarsius commented Feb 21, 2024

I think this might only affect the menu related steps. Please give my fixup commit a try.

@LemonBreezes LemonBreezes force-pushed the check-current-buffer-in-post-command-hook branch from 73a0ff2 to 7350f48 Compare February 21, 2024 16:18
@LemonBreezes
Copy link
Contributor Author

I think this might only affect the menu related steps. Please give my fixup commit a try.

Yup, this works. Just force-pushed to fix a typo.

The command may have used `set-window-buffer' to change the window's
buffer without changing the current buffer.  Previously that would
have resulted in an error because `magit-section-post-command-hook'
was not prepared to handle this situation, now we simply skip the
menu related work in this case.  Also see magit#5098.
@tarsius tarsius force-pushed the check-current-buffer-in-post-command-hook branch from 7350f48 to 039a180 Compare February 22, 2024 11:54
@tarsius tarsius merged commit 039a180 into magit:main Feb 22, 2024
28 checks passed
@tarsius
Copy link
Member

tarsius commented Feb 22, 2024

I would like to investigate this some more1, but since I don't have the time for that now and this commit does the job, I am merging it. Thanks, by the way. I think I ran into this myself before, but couldn't [/didn't try to] figure out what was going on.

Footnotes

  1. We might be able to further reduce the cope of the condition and/or we should move that to another function altogether. Maybe something else, well see -- at a later time. 😀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants