Set TERM via on-remote infocmp probe, not env propagation#232
Merged
Conversation
The previous fix (6a6101a) rebound `tramp-terminal-type', which only takes effect on the generic `tramp-handle-make-process' path; the ssh-method path (`tramp-sh-handle-make-process') ignores it entirely. In addition, when the local default top-level `process-environment' already has TERM=xterm-ghostty (e.g. Emacs launched from ghostty), `tramp-local-environment- variable-p' strips ghostel's pushed TERM as "ambient", and the remote shell inherits TERM=dumb from TRAMP's connection shell — disabling readline/ZLE/fish line editing on the remote. Move the decision into the per-spawn `/bin/sh -c' wrapper so the remote shell decides after env propagation: - probe via `infocmp xterm-ghostty'; on success advertise ghostty, otherwise fall back to xterm-256color so echo works; - when ~/.local/share/ghostel/terminfo holds the bundled entry, prepend it to TERMINFO_DIRS first so manual setups can co-locate terminfo with the shell-integration scripts (no `tic', no ~/.terminfo); - the local TERMINFO path is no longer pushed to the remote — it pointed at a directory the remote couldn't read and (per terminfo(5)) suppressed system lookups. README "Option 2: Manual setup" updated with the one-shot install recipe (shell scripts + co-located terminfo in one mkdir+scp burst). Closes #224 again.
8d8cdbc to
a026bbd
Compare
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.
Summary
Fixes #224 (again). The previous fix (6a6101a) rebound
tramp-terminal-type, but that variable is only consulted bytramp-handle-make-process(the generic handler). The ssh-method path most users hit (tramp-sh-handle-make-process) ignores it entirely. Plus, when the local default-toplevelprocess-environmentalready hadTERM=xterm-ghostty(e.g. Emacs launched from ghostty),tramp-local-environment-variable-pstripped ghostel's pushed TERM as "ambient" — and the remote shell inheritedTERM=dumbfrom TRAMP's connection shell, disabling readline/ZLE/fish line editing.The new approach moves the TERM decision into the per-spawn
/bin/sh -cwrapper so the remote shell decides after env propagation:infocmp xterm-ghostty. On hit, advertise ghostty (TERM/TERM_PROGRAM/TERM_PROGRAM_VERSION); on miss, fall back toxterm-256colorso echo works.~/.local/share/ghostel/terminfoholds the bundled entry, prepend it toTERMINFO_DIRSbefore the probe — manual setups can co-locate terminfo with the shell scripts (notic, no~/.terminfo).tramp-terminal-typelet-binding from 6a6101a is removed.README "Option 2: Manual setup" updated with the one-shot install recipe (shell scripts + co-located terminfo in one mkdir + scp burst).
Test plan
make -j4 allgreen (219/219 elisp, 47/47 native, lint, build)/bin/sh -csees literal~/...and expands correctlyHOMEoverride +tramp-shell-quote-argumentsimulationghostel-test-remote-term-preambleandghostel-test-spawn-pty-uses-remote-term-preamblecover the wrapper shape, the env-doesn't-leak-TERM-or-TERMINFO contract, and the load-bearing order (TERMINFO_DIRS prepend BEFORE theinfocmpprobe)/ssh:session (manual, since TRAMP isn't covered by the automated test suite)Behavioral matrix
ghostel-tramp-shell-integration t~/.terminfo~/.local/share/ghostel/terminfo