Emacs shell: set TERM to ansi instead of dumb

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Emacs shell: set TERM to ansi instead of dumb

Trevor Spiteri
Hello,

Since the terminal for M-x shell seems to support ansi colors and cursor
movement, would it make sense to set TERM to ansi instead of dumb? I
currently have an init_bash.sh containing the line TERM=ansi, but it
seems to me that it would be better for that to be the default.

Regards.

Trevor


Reply | Threaded
Open this post in threaded view
|

Re: Emacs shell: set TERM to ansi instead of dumb

Colin Baxter
>>>>> Trevor Spiteri <[hidden email]> writes:

    > Hello, Since the terminal for M-x shell seems to support ansi
    > colors and cursor movement, would it make sense to set TERM to
    > ansi instead of dumb? I currently have an init_bash.sh containing
    > the line TERM=ansi, but it seems to me that it would be better for
    > that to be the default.

    > Regards.

    > Trevor

You can also get colours if you just add "TERM dumb" to your
~/.dircolors file.

Best wishes,



--
Colin Baxter
www.Colin-Baxter.com

Reply | Threaded
Open this post in threaded view
|

Re: Emacs shell: set TERM to ansi instead of dumb

Juri Linkov-2
In reply to this post by Trevor Spiteri
> Since the terminal for M-x shell seems to support ansi colors and cursor
> movement, would it make sense to set TERM to ansi instead of dumb? I
> currently have an init_bash.sh containing the line TERM=ansi, but it seems
> to me that it would be better for that to be the default.

Thanks for suggestion.  I tried to use "TERM=ansi" together with
customizing 'comint-terminfo-terminal' to "ansi", and it works fine
everywhere, except compilation mode.  In compilation buffers
it inserts unhandled escape sequences that break fontification.
Had to disable ansi in compilation by customizing
'compilation-environment' to '("TERM=dumb")'.

Reply | Threaded
Open this post in threaded view
|

Re: Emacs shell: set TERM to ansi instead of dumb

Andrés Ramírez-2
Hi Juri.

Juri> Thanks for suggestion.  I tried to use "TERM=ansi" together with
Juri> customizing 'comint-terminfo-terminal' to "ansi", and it works
Juri> fine everywhere, except compilation mode.  In compilation
Juri> buffers it inserts unhandled escape sequences that break
Juri> fontification.  Had to disable ansi in compilation by
Juri> customizing 'compilation-environment' to '("TERM=dumb")'.

I am still seeing the "unhandled escape sequences" on "*compilation*"
buffer see:
--8<---------------cut here---------------start------------->8---
-*- mode: compilation; default-directory: "/ssh:aramirez@x220c:/home/aramirez/dev/wxwidgets/mamacha/src/tests/build/" -*-
Compilation started at Wed Dec  4 01:34:34

cd build && make -k -j4   && cd -
[35m[1mScanning dependencies of target invcross_tests[0m
make: Target 'default_target' not remade because of errors.
...
Compilation exited abnormally with code 2 at Wed Dec  4 01:34:36
--8<---------------cut here---------------end--------------->8---

BTW, above is compilation by tramp.

Those were my customizations:
--8<---------------cut here---------------start------------->8---
(progn (setq comint-terminfo-terminal "ansi") (add-to-list 'compilation-environment "TERM=dumb"))
--8<---------------cut here---------------end--------------->8---

Is there something else. I should customize?

BR
ps: probably the escape sequences are going to be replaced when sending
email. In that case https://termbin.com/41th

Reply | Threaded
Open this post in threaded view
|

Re: Emacs shell: set TERM to ansi instead of dumb

Juri Linkov-2
> cd build && make -k -j4   && cd -
> [35m[1mScanning dependencies of target invcross_tests[0m
> make: Target 'default_target' not remade because of errors.
> ...
> Compilation exited abnormally with code 2 at Wed Dec  4 01:34:36
>
>
> BTW, above is compilation by tramp.
>
> Those were my customizations:
>
> (progn (setq comint-terminfo-terminal "ansi") (add-to-list 'compilation-environment "TERM=dumb"))
>
> Is there something else. I should customize?

Please try to add "TERM=dumb" to 'tramp-remote-process-environment'.

Reply | Threaded
Open this post in threaded view
|

tramp compilation buffer also affected (was: Emacs shell: set TERM to ansi instead of dumb)

Andrés Ramírez-2
Hi Juri.

Juri> Please try to add "TERM=dumb" to
Juri> 'tramp-remote-process-environment'.

Same issue after adding the item to the list:
--8<---------------cut here---------------start------------->8---
-*- mode: compilation; default-directory: "/ssh:aramirez@x220c:/home/olla/dev/wxwidgets/mamacha/src/tests/build/" -*-
Compilation started at Thu Dec  5 00:03:36

cd build && make -k -j4 && cd -
[  0%] [32mBuilding C object CMakeFiles/invcross_tests.dir/test_runner.c.o[0m
[100%] [32m[1mLinking C executable ../invcross_tests[0m
[100%] Built target invcross_tests
/home/olla/dev/wxwidgets/mamacha/src/tests

Compilation finished at Thu Dec  5 00:03:43
--8<---------------cut here---------------end--------------->8---

BTW: I also did (tramp-cleanup-this-connection, tramp-cleanup-all-buffers)
AR