Skip to content

Extract a ghostel-shell module along the terminal/shell boundary - #651

Merged
dakra merged 1 commit into
mainfrom
refactor/ghostel-shell-module
Aug 25, 2026
Merged

dakra merged 1 commit into
mainfrom
refactor/ghostel-shell-module

Conversation

@dakra

@dakra dakra commented Aug 25, 2026

Copy link
Copy Markdown
Owner

Split along the terminal/shell boundary: the core terminal emulator (VT plumbing, rendering, input encoding, PTY spawning) works for any program, while everything that knows a shell is on the other side was smeared across ghostel.el and ghostel-prompt.el. This collects it into one module, lisp/ghostel-shell.el:

  • Shell detection & spawn-spec resolution — ghostel--detect-shell, ghostel--resolve-shell-spec and friends, the macOS login(1) wrap, and the ghostel-tramp-shells option next to its parser.
  • Shell-integration injection — the local rc-bootstrap (now ghostel--setup-local-integration, returning the same (:env :args) plist shape as the remote path so the bash ENV/--posix mechanism lives in one place), remote (TRAMP) temp-file setup, and the remote terminfo push tangled into it.
  • OSC 133 semantic prompts — all of ghostel-prompt.el (deleted) plus the state it forward-declared from core: ghostel--command-running, ghostel--prompt-positions, the command start/finish hooks.
  • Shell history — ghostel-shell-history and its defcustom, grouped with ghostel--detect-shell which keys it.

ghostel--start-process stays in core as the orchestrator, and core requires ghostel-shell eagerly exactly as it required ghostel-prompt, so the native OSC 133 marker handler exists before any VT data is processed. All ghostel-*.el files are internal (users only (require 'ghostel)), so no compatibility shims are needed.

Pure code motion apart from the two named changes (the ghostel--setup-local-integration extraction and the (:env :args) unification in ghostel--start-process). make -j8 all (build, elisp + native + zig tests, evil/consult extensions, lint) is green; test/ghostel-shell-test.el and test/ghostel-shell-history-test.el already map 1:1 to the new module.

Collect everything that knows a shell is on the other side of the PTY
into lisp/ghostel-shell.el: shell detection and spawn-spec resolution
(local, TRAMP via ghostel-tramp-shells, and the macOS login wrap),
shell-integration injection (local rc bootstrap, remote temp-file
setup, and the remote terminfo push tangled into it), the OSC 133
semantic-prompt state with its navigation and imenu consumers (all of
ghostel-prompt.el, which is deleted), and shell history retrieval.

The core terminal emulator keeps ghostel--start-process as the
orchestrator; the local rc-bootstrap that was inline there becomes
ghostel--setup-local-integration in the shell module, returning the
same (:env :args) plist shape as the remote path so the bash
ENV/--posix mechanism lives in one place.  Core requires ghostel-shell
eagerly, exactly as it required ghostel-prompt, so the native marker
handler exists before any VT data is processed.
@dakra
dakra force-pushed the refactor/ghostel-shell-module branch from 9af6416 to 484a4c1 Compare August 25, 2026 11:31
@dakra
dakra merged commit 484a4c1 into main Aug 25, 2026
42 of 48 checks passed
@dakra
dakra deleted the refactor/ghostel-shell-module branch August 25, 2026 11:52

This branch was previously deployed

1 inactive deployment
github-pages — 484a4c15 Deployed Aug 25, 2026 by dakra via deploy #172
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.

1 participant