unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* ls lists funky names within M-x shell
@ 2006-02-11  0:52 Doug Morris
  2006-02-11  1:51 ` John Paul Wallington
  2006-02-11 11:30 ` Peter Dyballa
  0 siblings, 2 replies; 4+ messages in thread
From: Doug Morris @ 2006-02-11  0:52 UTC (permalink / raw)


Anyone know why I get garbage with my file names (e.g. [01;34mcvs^[[0m)
using ls within the shell from M-x shell?  For example:

doug@gladyce ~/keep/dev/javagui/cmd $ ls -l
^[[0mtotal 24
-rwxr-xr-x  1 doug users 1196 Jan 25 15:40 ^[[01;32mcompile^[[0m
-rwxr-xr-x  1 doug users 1196 Jul  7  2003 ^[[01;32mcompile~^[[0m
drwxr-xr-x  3 doug users  176 Jul  7  2003 ^[[01;34mcvs^[[0m
-rwxr-xr-x  1 doug users  858 Jul  7  2003 ^[[01;32mdocument~^[[0m
-rwxr-xr-x  1 doug users  901 Jul  7  2003 ^[[01;32mjavadoc^[[0m
-rwxr-xr-x  1 doug users  309 Jul  7  2003 ^[[01;32mtest^[[0m
-rwxr-xr-x  1 doug users  272 Jul  7  2003 ^[[01;32mtest~^[[0m
^[[mdoug@gladyce ~/keep/dev/javagui/cmd $ 

Thanks,

Doug

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: ls lists funky names within M-x shell
  2006-02-11  0:52 ls lists funky names within M-x shell Doug Morris
@ 2006-02-11  1:51 ` John Paul Wallington
  2006-02-11  2:10   ` John Paul Wallington
  2006-02-11 11:30 ` Peter Dyballa
  1 sibling, 1 reply; 4+ messages in thread
From: John Paul Wallington @ 2006-02-11  1:51 UTC (permalink / raw)


Doug Morris <dougbmorris@yahoo.com> writes:

> Anyone know why I get garbage with my file names (e.g. [01;34mcvs^[[0m)
> using ls within the shell from M-x shell?  For example:
>
> doug@gladyce ~/keep/dev/javagui/cmd $ ls -l
> ^[[0mtotal 24
> -rwxr-xr-x  1 doug users 1196 Jan 25 15:40 ^[[01;32mcompile^[[0m
[...]

They are SGR control codes that typically represent colours.  Your ls
program is presently configured to output these sequences -- you
probably see colourful listings using ls in an xterm or at the
console.  To display the colours within Emacs for all comint-based
modes including `shell-mode' you can add:

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

to your .emacs file.

If you would rather it only applied to `shell-mode' buffers then you
could add:

(add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on)

instead.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: ls lists funky names within M-x shell
  2006-02-11  1:51 ` John Paul Wallington
@ 2006-02-11  2:10   ` John Paul Wallington
  0 siblings, 0 replies; 4+ messages in thread
From: John Paul Wallington @ 2006-02-11  2:10 UTC (permalink / raw)


jpw@pobox.com (John Paul Wallington) writes:

> If you would rather it only applied to `shell-mode' buffers then you
> could add:
> 
> (add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on)
> 
> instead.

Actually, that's false.  It will delay turning
`ansi-color-for-comint-mode' on for all comint-based modes until
`shell-mode' is run.  Instead you could do:

(add-hook 'shell-mode-hook (lambda ()
                             (make-local-variable 'ansi-color-for-comint-mode)
                             (ansi-color-for-comint-mode-on)))

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: ls lists funky names within M-x shell
  2006-02-11  0:52 ls lists funky names within M-x shell Doug Morris
  2006-02-11  1:51 ` John Paul Wallington
@ 2006-02-11 11:30 ` Peter Dyballa
  1 sibling, 0 replies; 4+ messages in thread
From: Peter Dyballa @ 2006-02-11 11:30 UTC (permalink / raw)
  Cc: help-gnu-emacs


Am 11.02.2006 um 00:52 schrieb Doug Morris:

> doug@gladyce ~/keep/dev/javagui/cmd $ ls -l
> ^[[0mtotal 24
> -rwxr-xr-x  1 doug users 1196 Jan 25 15:40 ^[[01;32mcompile^[[0m
> -rwxr-xr-x  1 doug users 1196 Jul  7  2003 ^[[01;32mcompile~^[[0m
> drwxr-xr-x  3 doug users  176 Jul  7  2003 ^[[01;34mcvs^[[0m

You could set in your ~/.emacs_<shell> file an alias for ls that  
invokes it without colorising its output, or you can make  
~/.emacs_<shell> to un-set an environment variable that makes ls  
colorise its output.

You should invoke M-x manual-entry RET ls RET in emacs to read about  
your system's actual ls implementation, and maybe do an M-x manual- 
entry RET <your shell> RET too.


This ls output colorisation can't work, IMO, inside an usual Emacs  
shell since its TERM value is set to dumb. It might work better  
inside the more complete terminal emulation (M-x term <RET>), but  
could be you need a modern implementation of ANSI to see colours from  
ls in the running shell, i.e. GNU Emacs 22 from CVS.

--
Greetings

   Pete

There are two major products that come out of Berkeley: LSD and UNIX.  
We don't believe this to be a coincidence. - Jeremy S. Anderson

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-02-11 11:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-02-11  0:52 ls lists funky names within M-x shell Doug Morris
2006-02-11  1:51 ` John Paul Wallington
2006-02-11  2:10   ` John Paul Wallington
2006-02-11 11:30 ` Peter Dyballa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).