Ignore the daemon's dummy initial frame when sizing the PTY#505
Merged
Conversation
Killing the buffer shown in the Emacs daemon's invisible 80x24 initial frame substitutes the ghostel buffer into its sole window, and `window-adjust-process-window-size-smallest' then clamped the terminal to that dummy window (79x22). Filter such windows out of `ghostel--windows' so the window-size hook (`ghostel--adjust-size') never sees them, and set the processes' `adjust-window-size-function' to `ignore': a nil property does not opt out of core's `window--adjust-process-windows' (it falls back to the global default), which kept resizing the Emacs-path PTY from an unfiltered all-frames window list, overwriting the winsize the Zig renderer syncs on resize. Fixes #504
dakra
force-pushed
the
fix/504-daemon-dummy-frame
branch
from
July 2, 2026 22:27
ccdf6a9 to
109ed0d
Compare
emil-e
approved these changes
Jul 2, 2026
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.
Problem
With an Emacs daemon + client frame, killing the buffer that was selected when
M-x ghostelwas started (e.g.*scratch*) resets the PTY to 79x22 (issue #504).The daemon keeps an invisible ~80x24 initial frame whose sole window shows
*scratch*. Killing that buffer substitutes the ghostel buffer into that window. Both ghostel's own resize path (ghostel--windowswith all-frames) and core'swindow--adjust-process-windowscollect windows across all frames, sowindow-adjust-process-window-size-smallestclamps the PTY to the dummy window's 79x22 body.Note that
frame-visible-pandterminal-live-pare bothton the dummy frame, so visibility can't be used as a filter; the reliable test is(and (daemonp) (eq frame terminal-frame))—Vterminal_frameis assigned exactly once at startup, so client tty frames are never affected.Fix
ghostel--daemon-dummy-frame-p: identifies the dummy frame.ghostel--windowsnow skips windows on it — fixes the clamp inghostel--adjust-sizeand keepsghostel--get-render-window/anchoring off the dummy frame.ghostel--adjust-process-window-sizedrops dummy-frame windows and delegates to the standard sizing function; installed as the process'sadjust-window-size-functionon both PTY spawn sites (ghostel--spawn-pty,ghostel-compile). The previous(process-put proc 'adjust-window-size-function nil)was a no-op — core falls back to the globalwindow-adjust-process-window-size-functionon a nil property, so core was resizing the elisp PTY with an unfiltered all-frames window list.If the buffer is shown only in the dummy frame, the window list is empty and the sizing function returns nil, leaving the PTY size alone.
Verification
*scratch*(was 22x79),stty sizeconfirms; normal window resizes still track on both the native-PTY and elisp-PTY (ghostel-use-native-ptynil) paths.For the record: eat exhibits the identical bug (verified live), and core's
window--process-window-listwalks all frames, so this is arguably also an upstream Emacs issue.Fixes #504