I'm running doom emacs, and here's an example of a command I ran and the resulting output. For some reason, term
gets filled with these random character codes. Any suggestions on how to fix this?
1 Answer
AFAIK, any escape sequences of the form ESC ]...
are OSC (Operating System Command) sequences, and support varies fairly widely.
(For instance, https://github.com/Alhadis/OSC8-Adoption is a repository someone made in order to track support for a sequence for embedding hyperlinks in terminal output.)
FWIW comint (and hence M-x shell
) can support some of these (OSCs 2,7,8 in Emacs 29.1) if you add comint-osc-process-output
to comint-output-filter-functions
; but I believe M-x term
has no equivalent support at present.
Your case is mostly OSC 4, and https://github.com/microsoft/vscode/issues/139645 seems as good an explanation as I've managed to find.
You might find that the program you're running has some options or config to tell it not to spit out this stuff, as it's not supported everywhere. (If not, you could raise a bug report with them.)
vterm
, which doesn't seem to have this problem