Repository navigation
Fix buffer-local window-change hooks before Emacs 31 - #798
Merged
Merged
Conversation
Until Emacs 31 a buffer-local `window-buffer-change-functions' entry runs in whatever buffer is current, so comparing the window's buffer with the current one skipped anchoring a ghostel buffer displayed in a window that is not selected, e.g. via `display-buffer' from another buffer. Keep the comparison from Emacs 31, where the hook runs in its own buffer and also for the buffer the window lost.
`ghostel--sync-tty-composition' is a buffer-local `window-buffer-change-functions' entry but set `auto-composition-mode' in the current buffer. Before Emacs 31 that is whatever buffer is current, so showing a ghostel buffer on a TTY frame via `display-buffer' turned composition off in the calling buffer and left the ghostel buffer unset. Set it in the window's buffer, and only for a ghostel buffer.
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Until Emacs 31, a buffer-local
window-buffer-change-functionsentry runs in whatever buffer is current, not in its own buffer (Emacs commit 1434bc97dc9 changed that). Two ghostel hooks assumed their own buffer:ghostel--window-buffer-changecompared the window's buffer with the current one, so a ghostel buffer shown in an unselected window (e.g.display-bufferfrom another buffer) was never anchored. The comparison now applies only from Emacs 31, where the hook also runs for the buffer the window lost;ghostel--anchor-windowalready resolves the window's buffer itself.ghostel--sync-tty-compositionsetauto-composition-modein the current buffer, so on a TTY frame it turned composition off in the calling buffer and left the ghostel buffer unset. It now sets it in the window's buffer, only for a ghostel buffer.The pre-31 hook behaviour was confirmed with a standalone copy of the anchoring guard on Emacs 29.4 and 30.2 (Docker) against 32.0.50. Both new tests fail on the old code.
Caveat: Emacs master builds reporting 31.0.50 from before 2025-10-06 lack the upstream change and keep the old anchoring behaviour.