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?

enter image description here

  • have started using vterm, which doesn't seem to have this problem
    – shintuku
    Dec 3, 2023 at 22:53

1 Answer 1


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.)

  • Thanks a lot for the help!
    – shintuku
    Dec 4, 2023 at 0:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.