문제

I M-x shell to run a program that tries to produce nice color output. But I get:

?- true.
^[[1mtrue.^[[0m

This is clearly not a fault of EMACS, as it sets the environment variable TERM to dumb. It is just the program I called that ignored this information.

I am aware of ansi-color-for-comint-mode-on which fixes this problem in an ad hoc manner: The environment variable TERM is still dumb. That is, a program interpreting this variable accordingly would not use escapes at all.

Is there a less ad-hoc approach to this, setting the TERM or similar?

도움이 되었습니까?

해결책 2

You can use M-x ansi-term instead of the other shells (M-x shell, M-x term and M-x eshell). Ansi-term was designed to work off-the-shelf with ansi colors. And even better, I suggest that you use multi-term (you can read more about it here and here) which essentially supports all the features of ansi-term plus the ability to easily switch between terminals and define which keyboard shortcuts are sent to the terminal and which ones are captured and interpreted by Emacs.

다른 팁

If M-x ansi-color-for-comint-mode-on does it, customizing ansi-color-for-comint-mode should be all you need.

Maybe, in line with the examples below:

(setenv "DISPLAY" ":0")

(setenv "PATH" (concat "/home/an_user/bin:"
                (getenv "PATH")))

You could try:

(setenv "TERM" ....)

Or is this not what you had in mind?

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top