# Reserved for Emacs (OSC 51)

> A number xterm sets aside for the Emacs shell, and does nothing with itself.

- **Sequence:** `OSC 51 ; Pt ST`
- **ECMA-48:** [§8.3.89 OSC – Operating System Command, p. 51](https://archive.org/details/ecma-48-5th-edition-june-1991/page/n64/mode/1up)
- **xterm:** [Operating System Commands](https://invisible-island.net/xterm/ctlseqs/ctlseqs.html)

xterm's [Control Sequences](https://invisible-island.net/xterm/ctlseqs/ctlseqs.html)
document lists `OSC 51` as "reserved for Emacs shell": a number set aside so
that Emacs's terminal modes can use it for their own messages without
clashing with anything xterm does. Emacs's `vterm` package, for one, sends
commands to Emacs through it. xterm itself does nothing with it
([`do_osc`](https://github.com/ThomasDickey/xterm-snapshots/blob/xterm-411a/misc.c#L4350-L4356)),
and neither does libghostty-vt, which passes.

## Validation

### OSC51-1: Ignored

Input, one step per line:

```text
A
\e]51;Efind-file "~/notes"\a
B
```

Expected screen:

```text
|AB____|
cursor 1,3
reply none
```

---

This is the Markdown version of <https://control-codes.page/osc/emacs/>. On that page every validation case runs live in libghostty-vt, the terminal emulation core of Ghostty, compiled to WebAssembly.

The validation cases are written in the notation described in <https://control-codes.page/notation/index.html.md>.
