Re: getting 'clear' to work in Emacs shell

2010-10-19 Thread Oleksandr Gavenko

On 18.10.2010 16:53, Jeff Rancier wrote:

GNU Emacs 21.3.1 (i386-msvc-nt5.1.2600) of 2003-03-27 on buffy
GNU bash, version 3.2.51(24)-release (i686-pc-cygwin)
CYGWIN_NT-5.1 1.7.7(0.230/5/3) 2010-08-31 09:58
Microsoft Windows XP Pro - Version 2002, SP3

The 'clear' work's  in a Cygwin Bash session,

c106...@usliny2r86krp8 ~
$ alias  clear
alias clear='cat ~/.cls'

c106...@usliny2r86krp8 ~
$ less  .cls
ESC[2J
.cls (END)

But doesn't  within Emacs:

C-z runs the command  shell
which is an interactive compiled Lisp function in `shell'.
(shelloptional BUFFER)

All I get within an  Emacs shell session is the following, without clearing the
screen.  Is there  some envionment variable I need to set here?


bash-3.2$  clear
[2J
bash-3.2$


As I understand you run M-x shell and type 'clear RET' and expect that
Emacs buffer cleared and contain only new prompt.

shell-mode does not designed to work as terminal.

Try use M-x term witch try emulate terminal behavior (thus allow run 
ncurses apps).


I run Emacs in 'mintty', type M-x term, I was asked for shell, select 
default '/bin/sh',

type RET and get prompt.

Under prompt type 'ls', get list of file, type 'clear', get error

sh-3.2$ clear
'eterm-color': unknown terminal type

next type 'export TERM=xterm RET' and 'clear'. I get 'sh-3.2$' prompt 
and all previous output

cleared.

As I understand that is you want.

shell-mode does  not understand terminal ESC sequences.

For example there exist special functions:

ansi-color-for-comint-mode-on
ansi-color-for-comint-mode-off

When you type in shell-mode 'ls --color' with ansi-color-for-comint-mode-off
you get such output:

^[[0m^[[01;34mApplication Data^[[0m  ^[[01;34mNetHood^[[0m 
^[[01;32mntuser.ini^[[0m  ^[[01;34mSendTo^[[0m  \

  ^[[01;34mМои документы^[[0m

When you type in shell-mode 'ls --color' with ansi-color-for-comint-mode-on
you get colorized output like in terminal:

Application Data  NetHood ntuser.ini  SendToМои документы


--
Problem reports:   http://cygwin.com/problems.html
FAQ:   http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple



Re: getting 'clear' to work in Emacs shell

2010-10-19 Thread Oleksandr Gavenko

On 19.10.2010 11:55, Oleksandr Gavenko wrote:


shell-mode does not understand terminal ESC sequences.

For example there exist special functions:

ansi-color-for-comint-mode-on
ansi-color-for-comint-mode-off


I want say that some useful terminal ESC sequences Emacs shell-mode
can handle properly.

Other like generated by clear is not.

But in shell-mode Emacs set TERM=dumb, from manual for 'clear'
it uses terminfo db, so must not generate any output.

So or your terminfo db damaged or you have invalid TERM env var in 
shell-mode

(for example it can be set in ~/.bashrc).



--
Problem reports:   http://cygwin.com/problems.html
FAQ:   http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple



Re: getting 'clear' to work in Emacs shell

2010-10-18 Thread Ken Brown

On 10/18/2010 9:53 AM, Jeff Rancier wrote:

GNU Emacs 21.3.1 (i386-msvc-nt5.1.2600) of 2003-03-27 on buffy
GNU bash, version 3.2.51(24)-release (i686-pc-cygwin)
CYGWIN_NT-5.1 1.7.7(0.230/5/3) 2010-08-31 09:58
Microsoft Windows XP Pro - Version 2002, SP3

The 'clear' work's  in a Cygwin Bash session,

c106...@usliny2r86krp8 ~
$ alias  clear
alias clear='cat ~/.cls'

c106...@usliny2r86krp8 ~
$ less  .cls
ESC[2J
.cls (END)

But doesn't  within Emacs:

C-z runs the command  shell
which is an interactive compiled Lisp function in `shell'.
(shelloptional BUFFER)

All I get within an  Emacs shell session is the following, without clearing the
screen.  Is there  some envionment variable I need to set here?


bash-3.2$  clear
[2J
bash-3.2$


I'm not sure what you're expecting here.  Do you want emacs to delete 
what's in the *shell* buffer?  Or just scroll it so that nothing is 
visible but the prompt?  FWIW, typing 'clear' in an emacs shell buffer 
under Linux doesn't have any visible effect either.  (Here it runs 
/usr/bin/clear.)  So I don't think this has anything to do with Cygwin.


Ken

Ken

--
Problem reports:   http://cygwin.com/problems.html
FAQ:   http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple