0

This seems to be a duplicate of emacs strips away all ansi color codes in shells but it's not!

It differs in that I cannot only see any ansi-color but that I cannot EVEN see the raw escape color codes (that should be there regarding the conversation and comments at the referred question).

I am on OSX (10.10.2) and GNU EMACS (official dl: http://emacsformacosx.com/)

Here are the simple steps to reproduce my problem:

emacs -q goto *scratch* buffer and execute:

(setq explicit-shell-file-name "bash")

(require 'ansi-color)

(ansi-color-for-comint-mode-on)

Then:

M-x shell

Now execute some shell commands that should return ansi-colors.

In my case there is nothing! I spent hours and hours checking and trying out all he answerers about ansi-colors -- no success. Above remained just the minimal steps.

Thank you all for helping me out.

p.s.: funny enough, if I use M-x ansi-term or even M-x eshell both of them show ansi-colors right out of the box!

Community
  • 1
  • 1
emelin
  • 101
  • 5
  • Are you running in a graphical window, or inside Terminal.app? – ChrisGPT was on strike Feb 04 '15 at 16:16
  • I have tested it in terminal: Terminal.app and iTerm2 `emacs -q` als well as running Emacs.app with no `.emacs` or `.emacs.d`. Btw. my bash is the standard /bin/bash shipping with osx: `GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin14) Copyright (C) 2007 Free Software Foundation, Inc.` – emelin Feb 04 '15 at 16:51
  • Just note: the bash that starts emacs has the envir var `$TERM` set to `xterm-256color` . The "shell" in shell-mode has this var set to `dumb` whitch is the emacs standard and expected. – emelin Feb 04 '15 at 17:03
  • @Chris Concerning the present issue, may I ask on what the question about Terminal.app was aiming at? In what ways is it relevant to problem? – emelin Feb 15 '15 at 20:28
  • Emacs as a standalone graphical application handles its own colours. Inside a terminal, it is limited by the colours and colour depth offered by the terminal. I was just trying to eliminate that limitation as a cause of your problem. – ChrisGPT was on strike Feb 16 '15 at 03:45
  • @Chris Thank you Chris for clarifying. I am aware of this and that's why I think it is all the more strange having working ansi-colors in eshell but not in shell mode. If you start `emacs -q` on the command line and then carry out the three commands in the *scratch* buffer above, what is your outcome. Do you actually have colors? – emelin Feb 17 '15 at 11:22
  • I didn't get more involved with this question because I virtually never use `M-x shell` and I'm not sure that I can help very much. I get some colours, but not the ones I would expect. When I type commands, `--flags` are red. My bash prompt contains `>`, which is blue. Executed commands are black, but bold. I don't get coloured output from `ls`, for example. Setting `$TERM` to `xterm-256color` *does* give me coloured output from `ls`, but you seem to think that this should work even if it is `dumb`. – ChrisGPT was on strike Feb 17 '15 at 13:13

1 Answers1

1

Thank you Chris for reporting and checking on your side! The issue was solved in two steps:

  1. indeed, set $TERM to xterm-256color
  2. use GNU ls --color but not the ls shipping with the MacOS.
emelin
  • 101
  • 5