This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: getting 'clear' to work in Emacs shell
- From: Oleksandr Gavenko <gavenko at bifit dot com dot ua>
- To: cygwin at cygwin dot com
- Date: Tue, 19 Oct 2010 11:55:27 +0300
- Subject: Re: getting 'clear' to work in Emacs shell
- References: <287016.30328.qm@web56705.mail.re3.yahoo.com>
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@USLINY2R86KRP8 ~
$ alias clear
alias clear='cat ~/.cls'
C106426@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