getting 'clear' to work in Emacs shell
Oleksandr Gavenko
gavenko@bifit.com.ua
Tue Oct 19 09:06:00 GMT 2010
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
More information about the Cygwin
mailing list