tninja / aider.el

aider emacs plugin for https://github.com/paul-gauthier/aider
Apache License 2.0
113 stars 8 forks source link

Color in output #9

Open RomeoV opened 3 weeks ago

RomeoV commented 3 weeks ago

Awesome package, thanks. Any chance we can enable color in the aider output inside emacs aswell? Currently it's a bit harder to read the code snippets. Presumably we'd need to forward the color codes that aider already outputs correctly to emacs?

tninja commented 3 weeks ago

Yeah agree that the current comint based solution lost the code color from aider output. i do try ansi color based change for the coming aider session buffer, suggested by ChatGPT, doesn’t work. ChatGPT said aider might used some more advanced coloring way, which currently beyond the ANSI color support inside emacs.

I tried and found that M-x ansi-term or M-x term, and then run aider. This aider session can support coloring output. But traditional inside emacs, the interactive session is usually based on comint (eg. R / python / sql support inside emacs). So i still wish there is a way to make comint session support coloring output for aider.

On Mon, Oct 14, 2024 at 3:25 PM RomeoV @.***> wrote:

Awesome package, thanks. Any chance we can enable color in the aider output inside emacs aswell? Currently it's a bit harder to read the code snippets. Presumably we'd need to forward the color codes that aider already outputs correctly to emacs?

— Reply to this email directly, view it on GitHub https://github.com/tninja/aider.el/issues/9, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFOPAMYQI4OURPUJXC3LSDZ3RAEFAVCNFSM6AAAAABP53JMU2VHI2DSMVQWIX3LMV43ASLTON2WKOZSGU4DOMJYGAYTSNI . You are receiving this because you are subscribed to this thread.Message ID: @.***>

CeleritasCelery commented 2 weeks ago

Aider does not send the color codes to the shell because we are telling it this a "dumb" terminal via comint-terminfo-terminal. If you set it to something else like "eterm-color" (an Emacs terminal) or "xterm-color" it will colorize the output, but it also screws things up because it sends a lot of other commands that comint doesn't understand and also expects to get to receive "cursor position requests" from Emacs (which it doesn't send). I am not sure if there is a value that gives just color output with breaking other things. Aider uses prompt-toolkit to handle the coloring and it checks for a dumb terminal here and disables colors here. See also prompt-toolkit/python-prompt-toolkit/#1032. Unfortunately that setting both disables interactive editing and colors, so I don't see a way to only enable colors.