Ghostel 0.59 runs Emacs async shell commands in a real terminal
2 hours ago
Ghostel 0.59 is out, and the headline is a new command, ghostel-shell-command. It's Emacs's async shell command, except the program gets a real terminal, so programs that misbehave under a dumb terminal get a proper one. This release also adds commands that always open a fresh terminal, and it fixes exit hooks on the native PTY.
Ask about this presentation
Chapters
Show transcriptHide transcript
Ghostel 0.59 is out, and the headline is a new command, ghostel-shell-command. It's Emacs's async shell command, except the program gets a real terminal, so programs that misbehave under a dumb terminal get a proper one. This release also adds commands that always open a fresh terminal, and it fixes exit hooks on the native PTY.
The command runs through your shell-file-name and shell-command-switch, so a remote TRAMP directory uses the remote host's shell. The output lands in a buffer called Ghostel Shell Command, which stays open after the command exits. And unlike ghostel-compile, it's a plain terminal, with no header, footer, or error parsing.
If that buffer is still running something, Ghostel follows your async-shell-command-buffer setting, the same variable M-& reads. It can kill the running command, use a new buffer, or rename the old one, and the confirm variants ask you first. A trailing ampersand is dropped, so the job stays in the foreground and its output stays in the terminal.
To use it everywhere, turn on ghostel-shell-command-global-mode. It advises shell-command, so M-&, Dired's ampersand, project-async-shell-command, and Lisp callers all land in a Ghostel terminal. Synchronous shell commands are left alone. If you only want M-& to change, remap that one command instead and leave the rest stock.
Two smaller additions open terminals. ghostel-new always creates a new terminal, the same as running ghostel with a prefix argument, and ghostel-project-new does the same in the project root. The terminal menu now calls them, so its entries read New Terminal and New Project Terminal.
On the native PTY, ghostel-exit-functions always received the word finished, whatever the child process returned. Now the hook gets the real status, like exited abnormally with code 3, which matches the Emacs PTY backend. The child's final output is also rendered before the hooks run, so a hook, or ghostel-kill-buffer-on-exit, sees a buffer with the last lines in it.
One thing moved. The project commands, and the ghostel-project-buffer-scope option, now live in ghostel-project.el. If you install Ghostel as a package, the commands are autoloaded, so there is nothing to add. If you load it from a bare load-path without package autoloads, add one line that requires ghostel-project.
When you upgrade, move the native module too. The Elisp now requires module version 0.59.0, because the module changed how it reports a child's exit status. The exit-status fix only changes the native PTY, since the Emacs PTY backend already reported it. That's Ghostel 0.59: async shell commands, in a real terminal.







