delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/10/19/04:55:58

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-0.2 required=5.0 tests=AWL,BAYES_00,RCVD_NUMERIC_HELO,SPF_HELO_PASS,T_RP_MATCHES_RCVD
X-Spam-Check-By: sourceware.org
To: cygwin AT cygwin DOT com
From: Oleksandr Gavenko <gavenko AT bifit DOT com DOT ua>
Subject: Re: getting 'clear' to work in Emacs shell
Date: Tue, 19 Oct 2010 11:55:27 +0300
Lines: 72
Message-ID: <i9jmdt$a22$1@dough.gmane.org>
References: <287016 DOT 30328 DOT qm AT web56705 DOT mail DOT re3 DOT yahoo DOT com>
Mime-Version: 1.0
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.9) Gecko/20100915 Thunderbird/3.1.4
In-Reply-To: <287016.30328.qm@web56705.mail.re3.yahoo.com>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Note-from-DJ: This may be spam

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,
>
> C106426 AT USLINY2R86KRP8 ~
> $ alias  clear
> alias clear='cat ~/.cls'
>
> C106426 AT 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'.
> (shell&optional 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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019