unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* help with M-x term
@ 2006-07-12 20:02 yz7502
  2006-07-13  2:56 ` William Daffer
  2006-07-13 15:14 ` Kevin Rodgers
  0 siblings, 2 replies; 13+ messages in thread
From: yz7502 @ 2006-07-12 20:02 UTC (permalink / raw)


Hi guys,
I have a question on the M-x term environment
I'm using ksh and I have some aliases defined in .emacs_ksh.
When I invoke M-x term, the aliases are not there.

Should I define the aliases somewhere else?

Thanks

Yadong

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

* Re: help with M-x term
  2006-07-12 20:02 help with M-x term yz7502
@ 2006-07-13  2:56 ` William Daffer
  2006-07-13 13:27   ` op132650c
                     ` (2 more replies)
  2006-07-13 15:14 ` Kevin Rodgers
  1 sibling, 3 replies; 13+ messages in thread
From: William Daffer @ 2006-07-13  2:56 UTC (permalink / raw)


yz7502@gmail.com writes:

> Hi guys,
> I have a question on the M-x term environment
> I'm using ksh and I have some aliases defined in .emacs_ksh.

  Are you sourcing this file in your init files anywhere?

> When I invoke M-x term, the aliases are not there.
>
> Should I define the aliases somewhere else?

  Is there some reason why you aren't using M-x shell?

whd
-- 
DISTANCE, n.  The only thing that the rich are willing for the poor to 
call theirs, and keep.
	-- Ambrose Bierce: _The Devil's Dictionary_

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

* Re: help with M-x term
  2006-07-13  2:56 ` William Daffer
@ 2006-07-13 13:27   ` op132650c
  2006-07-13 14:03   ` yz7502
       [not found]   ` <mailman.4055.1152797235.9609.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 13+ messages in thread
From: op132650c @ 2006-07-13 13:27 UTC (permalink / raw)


>   Is there some reason why you aren't using M-x shell?

I don't want to detour the attention about the question of William Daffer, but i
also prefer M-x term instead of M-x shell, because the output of M-x shell is
not well formatted compared to M-x term.

Now i put the following question:

What's the difference between M-x shell and M-x term?

How can i configure M-x shell to be well formatted?

One example of the bad formatation of the output of M-x shell, is when i do ls
-la.
I get the following:

]]] file1     ]]] file3^]]]     ]]] file5^]]]
 ]]] file2   ]]] file4^]]]     ]]] file6^]]]


With the M-x term i get well formatted:

file1   file3   file5
file2   file4   file6




Citando William Daffer <whdaffer@wabcmail.com>:

> yz7502@gmail.com writes:
>
> > Hi guys,
> > I have a question on the M-x term environment
> > I'm using ksh and I have some aliases defined in .emacs_ksh.
>
>   Are you sourcing this file in your init files anywhere?
>
> > When I invoke M-x term, the aliases are not there.
> >
> > Should I define the aliases somewhere else?
>
>   Is there some reason why you aren't using M-x shell?
>
> whd
> --
> DISTANCE, n.  The only thing that the rich are willing for the poor to
> call theirs, and keep.
> 	-- Ambrose Bierce: _The Devil's Dictionary_
> _______________________________________________
> help-gnu-emacs mailing list
> help-gnu-emacs@gnu.org
> http://lists.gnu.org/mailman/listinfo/help-gnu-emacs
>

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

* Re: help with M-x term
  2006-07-13  2:56 ` William Daffer
  2006-07-13 13:27   ` op132650c
@ 2006-07-13 14:03   ` yz7502
  2006-07-13 15:10     ` William Daffer
       [not found]   ` <mailman.4055.1152797235.9609.help-gnu-emacs@gnu.org>
  2 siblings, 1 reply; 13+ messages in thread
From: yz7502 @ 2006-07-13 14:03 UTC (permalink / raw)


Hi William,
I used to use M-x shell, but I have one application which requires
X-window, and the dumb term of M-x Shell does not support it.

On the other hand , M-x term seems to miss some env stuff.

Thanks for your reply.

Yadong

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

* Re: help with M-x term
  2006-07-13 14:03   ` yz7502
@ 2006-07-13 15:10     ` William Daffer
  2006-07-13 16:17       ` yz7502
  0 siblings, 1 reply; 13+ messages in thread
From: William Daffer @ 2006-07-13 15:10 UTC (permalink / raw)


yz7502@gmail.com writes:

> Hi William,
> I used to use M-x shell, but I have one application which requires
> X-window, and the dumb term of M-x Shell does not support it.
>
> On the other hand , M-x term seems to miss some env stuff.

I assume that your test of 'term mode' happened after setting up your
initialization files such that your normal shell saw these new aliases
and then logging out and back in again, or, in some other way making
those aliases available to whatever process started the emacs you
attempted 'M-x term' in, right?

whd
-- 
RICH, adj.  Holding in trust and subject to an accounting the property 
of the indolent, the incompetent, the unthrifty, the envious and the 
luckless.  That is the view that prevails in the underworld, where the 
Brotherhood of Man finds its most logical development and candid 
advocacy.  To denizens of the midworld the word means good and wise.
	-- Ambrose Bierce: _The Devil's Dictionary_

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

* Re: help with M-x term
  2006-07-12 20:02 help with M-x term yz7502
  2006-07-13  2:56 ` William Daffer
@ 2006-07-13 15:14 ` Kevin Rodgers
  1 sibling, 0 replies; 13+ messages in thread
From: Kevin Rodgers @ 2006-07-13 15:14 UTC (permalink / raw)


yz7502@gmail.com wrote:
> I have a question on the M-x term environment
> I'm using ksh and I have some aliases defined in .emacs_ksh.
> When I invoke M-x term, the aliases are not there.
> 
> Should I define the aliases somewhere else?

If those aliases are not specific to ksh when run under Emacs, then
yes you should define them in the $ENV file.  I've used a couple 
different approaches to setting ENV in my .profile:

case "$-" in
   (*i*) export ENV=$HOME/.kshrc ;;
   (*) unset ENV ;;
esac

or:

if [[ -f $HOME/.kshrc ]]; then
   export KSHRC=$HOME/.kshrc
   export ENV='${KSHRC[(_$-=0)+(_=1)-_${-%%*i*}]}'
fi

-- 
Kevin

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

* Re: help with M-x term
       [not found]   ` <mailman.4055.1152797235.9609.help-gnu-emacs@gnu.org>
@ 2006-07-13 15:16     ` William Daffer
  2006-07-14  5:25     ` Tim X
  1 sibling, 0 replies; 13+ messages in thread
From: William Daffer @ 2006-07-13 15:16 UTC (permalink / raw)


op132650c@mail.telepac.pt writes:

>>   Is there some reason why you aren't using M-x shell?
>
> I don't want to detour the attention about the question of William
> Daffer, but i also prefer M-x term instead of M-x shell, because the
> output of M-x shell is not well formatted compared to M-x term.
>
> Now i put the following question:
>
> What's the difference between M-x shell and M-x term?

  M-x term actually does terminal emulation where M-x shell
  doesn't. At least that's the only difference I see from 'info emacs
  shell'


>
> How can i configure M-x shell to be well formatted?
>
> One example of the bad formatation of the output of M-x shell, is
> when i do ls -la.  I get the following:
>
> ]]] file1     ]]] file3^]]]     ]]] file5^]]]
>  ]]] file2   ]]] file4^]]]     ]]] file6^]]]
>
>
> With the M-x term i get well formatted:
>
> file1   file3   file5
> file2   file4   file6
>

  I think that's the point of M-x term, or at least one of them.

  Me, I don't care about formatting when I'm using a shell inside
  emacs. I do it so infrequently and for such small things I just live
  with bad formatting. 

  But that may change.

 [snip]

whd
-- 
RESPLENDENT, adj.  Like a simple American citizen beduking himself in 
his lodge, or affirming his consequence in the Scheme of Things as an 
elemental unit of a parade.
        The Knights of Dominion were so resplendent in their velvet- 
    and-gold that their masters would hardly have known them.
                                           "Chronicles of the Classes"
	-- Ambrose Bierce: _The Devil's Dictionary_

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

* Re: help with M-x term
  2006-07-13 15:10     ` William Daffer
@ 2006-07-13 16:17       ` yz7502
  0 siblings, 0 replies; 13+ messages in thread
From: yz7502 @ 2006-07-13 16:17 UTC (permalink / raw)



William Daffer wrote:

> I assume that your test of 'term mode' happened after setting up your
> initialization files such that your normal shell saw these new aliases
> and then logging out and back in again,

I think this is it.
I did restart emacs, but I don't think I logged out yesterday.

I am very happy to see my aliases after I restarted everything this
morning.

Thank you all.

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

* Re: help with M-x term
       [not found]   ` <mailman.4055.1152797235.9609.help-gnu-emacs@gnu.org>
  2006-07-13 15:16     ` William Daffer
@ 2006-07-14  5:25     ` Tim X
  2006-07-14 10:35       ` Sergei
  1 sibling, 1 reply; 13+ messages in thread
From: Tim X @ 2006-07-14  5:25 UTC (permalink / raw)


op132650c@mail.telepac.pt writes:

>>   Is there some reason why you aren't using M-x shell?
>
> I don't want to detour the attention about the question of William Daffer, but i
> also prefer M-x term instead of M-x shell, because the output of M-x shell is
> not well formatted compared to M-x term.
>
> Now i put the following question:
>
> What's the difference between M-x shell and M-x term?
>
> How can i configure M-x shell to be well formatted?
>
> One example of the bad formatation of the output of M-x shell, is when i do ls
> -la.
> I get the following:
>
> ]]] file1     ]]] file3^]]]     ]]] file5^]]]
>  ]]] file2   ]]] file4^]]]     ]]] file6^]]]
>
>
> With the M-x term i get well formatted:
>
> file1   file3   file5
> file2   file4   file6
>

The difference in 'formatting' you have observed is because M-x shell
doesn't understand ANSI escape codes for colour. When you use the ls
command and have it configured to display the output using different
colours for different file types, it does this by using andsi colour
escape sequences. However, M-x shell does not understand these "out of
the box". 

There are at least two solutions -

1. configure ls not to use escape sequences when displaying a
   directory listing in a dumb terminal - one of the ls --color=
   values should do this

2. Enable support for ansi colours in comint derived modes - do an
   apropos for ansi color. M-x shell will then be able to interpret
   the ansi colour codes.

3. Use M-x term

Tim



-- 
tcross (at) rapttech dot com dot au

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

* Re: help with M-x term
  2006-07-14  5:25     ` Tim X
@ 2006-07-14 10:35       ` Sergei
  2006-07-15  0:28         ` Tim X
  0 siblings, 1 reply; 13+ messages in thread
From: Sergei @ 2006-07-14 10:35 UTC (permalink / raw)


--- Tim X:

...

> The difference in 'formatting' you have observed is because M-x shell
> doesn't understand ANSI escape codes for colour. When you use the ls
> command and have it configured to display the output using different
> colours for different file types, it does this by using andsi colour
> escape sequences. However, M-x shell does not understand these "out of
> the box".

> There are at least two solutions -

(THREE suggestions snipped :)

[...]

I've put setting LS_COLORS under a condition in my .bashrc :

if [ "$EMACS" != "t" ]
then
    PS1="$PS1_long"
    if [ "$OSVAR" = "Linux" ]; then
        LS_COLORS='...[set it to your liking] ...'
        export LS_COLORS
    else # Darwin:

        export LSCOLORS="DxfxcxdxbxegedabagDxDx"
    fi 
else 
    export PS1='\t \W \!% ' 
fi 

-- 
Sergei

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

* Re: help with M-x term
  2006-07-14 10:35       ` Sergei
@ 2006-07-15  0:28         ` Tim X
  2006-07-18  7:01           ` Sergei
  0 siblings, 1 reply; 13+ messages in thread
From: Tim X @ 2006-07-15  0:28 UTC (permalink / raw)


"Sergei" <sergio.pokrovskij@gmail.com> writes:

> --- Tim X:
>
> ...
>
>> The difference in 'formatting' you have observed is because M-x shell
>> doesn't understand ANSI escape codes for colour. When you use the ls
>> command and have it configured to display the output using different
>> colours for different file types, it does this by using andsi colour
>> escape sequences. However, M-x shell does not understand these "out of
>> the box".
>
>> There are at least two solutions -
>
> (THREE suggestions snipped :)
>
> [...]
>
> I've put setting LS_COLORS under a condition in my .bashrc :
>
> if [ "$EMACS" != "t" ]
> then
>     PS1="$PS1_long"
>     if [ "$OSVAR" = "Linux" ]; then
>         LS_COLORS='...[set it to your liking] ...'
>         export LS_COLORS
>     else # Darwin:
>
>         export LSCOLORS="DxfxcxdxbxegedabagDxDx"
>     fi 
> else 
>     export PS1='\t \W \!% ' 
> fi 
>

Yes, I've seen solutions of this style before. Its certainly one
solution. In fact, under Debian, the default .bashrc has

# enable color support of ls and also add handy aliases
    if [ "$TERM" != "dumb" ]; then
                eval `dircolors -b`
                alias ls='ls --color=auto'
                alias dir='ls --color=auto --format=vertical'
                alias vdir='ls --color=auto --format=long'
    fi

Which means ls colours are not used within M-x shell as it sets TERM
to dumb. This approach is I think more general in that it will prevent
ls colours from being used in any dumb terminal, not just emacs'
shell. I also note you are using the variable $OSVAR to detect if
running under Linux, but I don't think this is a "standard' variable
(i.e. it is distribution/local/user specific). I only mention it in
case someone uses your code snippet and is wondering why colour ls is
not behaving as expected. 

Tim

-- 
tcross (at) rapttech dot com dot au

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

* Re: help with M-x term
  2006-07-15  0:28         ` Tim X
@ 2006-07-18  7:01           ` Sergei
  2006-07-18  8:34             ` Tim X
  0 siblings, 1 reply; 13+ messages in thread
From: Sergei @ 2006-07-18  7:01 UTC (permalink / raw)


Tim X wrote:

[...]

> Yes, I've seen solutions of this style before. Its certainly one
> solution. In fact, under Debian, the default .bashrc has

> # enable color support of ls and also add handy aliases
>     if [ "$TERM" != "dumb" ]; then
>                 eval `dircolors -b`
>                 alias ls='ls --color=auto'
>                 alias dir='ls --color=auto --format=vertical'
>                 alias vdir='ls --color=auto --format=longx
>     fi

> Which means ls colours are not used within M-x shell as it sets TERM
> to dumb. This approach is I think more general in that it will
> prevent ls colours from being used in any dumb terminal, not just
> emacs' shell.

Maybe that's true.  But actually there are more colored thing than the
directories.

So far I was unable to solve the color problem with the perl debugger
:(

> I also note you are using the variable $OSVAR to detect if running
> under Linux, but I don't think this is a "standard' variable
> (i.e. it is distribution/local/user specific). I only mention it in
> case someone uses your code snippet and is wondering why colour ls
> is not behaving as expected.

You are right, I set OSVAR myself on the basis of uname inquiry.

-- 
Sergei

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

* Re: help with M-x term
  2006-07-18  7:01           ` Sergei
@ 2006-07-18  8:34             ` Tim X
  0 siblings, 0 replies; 13+ messages in thread
From: Tim X @ 2006-07-18  8:34 UTC (permalink / raw)


"Sergei" <sergio.pokrovskij@gmail.com> writes:

> Tim X wrote:
>
> [...]
>
>> Yes, I've seen solutions of this style before. Its certainly one
>> solution. In fact, under Debian, the default .bashrc has
>
>> # enable color support of ls and also add handy aliases
>>     if [ "$TERM" != "dumb" ]; then
>>                 eval `dircolors -b`
>>                 alias ls='ls --color=auto'
>>                 alias dir='ls --color=auto --format=vertical'
>>                 alias vdir='ls --color=auto --format=longx
>>     fi
>
>> Which means ls colours are not used within M-x shell as it sets TERM
>> to dumb. This approach is I think more general in that it will
>> prevent ls colours from being used in any dumb terminal, not just
>> emacs' shell.
>
> Maybe that's true.  But actually there are more colored thing than the
> directories.
>
> So far I was unable to solve the color problem with the perl debugger
> :(
>

Have you tried the various commands/settings for ansi-color in comint
mode? I'm assuming the perl debugger uses ansi escape sequences
(despite having done a number of years of perl, it was over 7 years
ago and I never got around to using the perl debugger. 

Tim

-- 
tcross (at) rapttech dot com dot au

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

end of thread, other threads:[~2006-07-18  8:34 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-12 20:02 help with M-x term yz7502
2006-07-13  2:56 ` William Daffer
2006-07-13 13:27   ` op132650c
2006-07-13 14:03   ` yz7502
2006-07-13 15:10     ` William Daffer
2006-07-13 16:17       ` yz7502
     [not found]   ` <mailman.4055.1152797235.9609.help-gnu-emacs@gnu.org>
2006-07-13 15:16     ` William Daffer
2006-07-14  5:25     ` Tim X
2006-07-14 10:35       ` Sergei
2006-07-15  0:28         ` Tim X
2006-07-18  7:01           ` Sergei
2006-07-18  8:34             ` Tim X
2006-07-13 15:14 ` Kevin Rodgers

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).