Rangi Lin
Rangi Lin

Reputation: 9441

Why does shell mode display some rubbish code?

When I use bower in M-x shell, as you can see in the picture, some rubbish code is displayed.

Emacs shell mode

However M-x ansi-term works well

ansi-term

What could be the problem ? Is it possible to make shell mode display properly ?

Upvotes: 1

Views: 598

Answers (3)

Ehvince
Ehvince

Reputation: 18375

Try the solution given in Cucumber's ANSI colors messing up emacs compilation buffer:

 (require 'ansi-color)
 (defun colorize-compilation-buffer ()
 (toggle-read-only)
 (ansi-color-apply-on-region (point-min) (point-max))
   (toggle-read-only))
 (add-hook 'compilation-filter-hook 'colorize-compilation-buffer)

that works beautifuly for me on emacs24.


ps: to colorize even more the shell output I like to play with

M-x highlight-regexp RET a regexp, i.e. \[OK\] RET a color (make use of TAB to see choices)

or

(add-hook 'shell-mode-hook (lambda () (highlight-regexp "\\[OK\\]" "hi-green-b")))

and (add-hook 'shell-mode-hook (lambda () (goto-address-mode ))) to make URLs clikable. Looking for the same stuff for file paths.

edit: making file paths clickable is as easy as using compilation-shell-minor-mode :)

edit2: my sources: http://wikemacs.org/index.php/Shell

Upvotes: 2

Andreas Röhler
Andreas Röhler

Reputation: 4804

WRT to bash, sometimes setting $PAGER helps here, i.e.

PAGER=cat

Upvotes: 0

Tim Pierce
Tim Pierce

Reputation: 5664

Those symbols are ANSI escape sequences that the terminal emulator uses for visual effects like changing the color of text. shell-mode apparently doesn't know how to display these codes by default. What you want may be Term Mode:

Some programs (such as Emacs itself) need to control the appearance of the terminal screen in detail. They do this by emitting special control codes. Term mode recognizes and handles ANSI-standard VT100-style escape sequences, which are accepted by most modern terminals, including xterm. (Hence, you can actually run Emacs inside an Emacs Term window.)

Upvotes: 2

Related Questions