* GNU Emacs 23.1 and Cygwin bash shell - cleaning up display
@ 2010-02-28 15:54 Paul Bibbings
2010-02-28 17:39 ` Pascal J. Bourguignon
0 siblings, 1 reply; 5+ messages in thread
From: Paul Bibbings @ 2010-02-28 15:54 UTC (permalink / raw
To: help-gnu-emacs
Hi
I'm running GNU Emacs 23.1 built for Windows (on Vista) and I'm wanting
to use Cygwin bash as an alternative shell. I'm trying out this
function from the Cygwin FAQ
(http://www.cygwin.com/faq/faq-nochunks.html#faq.using.ntemacs):
(defun my-bash (&optional buffer)
"Run Cygwin Bash shell in optional BUFFER; default *shell-bash*."
(autoload 'comint-check-proc "comint")
(interactive
(let ((name "*shell-bash*"))
(if current-prefix-arg
(setq name (read-string
(format "Cygwin shell buffer (default %s): " name)
(not 'initial-input)
(not 'history)
name)))
(list name)))
(or buffer
(setq buffer "*shell-bash*"))
(if (comint-check-proc buffer)
(pop-to-buffer buffer)
(let* ((shell-file-name "bash")
(explicit-shell-file-name shell-file-name)
(explicit-sh-args '("--login" "-i"))
(explicit-bash-args explicit-sh-args)
(w32-quote-process-args ?\"));; Use Cygwin quoting rules.
(shell buffer)
;; By default Emacs sends "\r\n", but bash wants plain "\n"
(set-buffer-process-coding-system 'undecided-dos 'undecided-unix)
;; With TAB completion, add slash path separator, none to filenames
(make-local-variable 'comint-completion-addsuffix)
(setq comint-completion-addsuffix '("/" . ""))
;; This variable is local to buffer
(setq comint-prompt-regexp "^[ \n\t]*[$] ?"))))
Now, this works fine in itself, but I'm experiencing the common problems
with how this displays with extra "noise." As an example, if we take
the following, using the bash shell directly in a Windows console:
c:\cygwin>cygwin.bat
Me@MY ~
$ pwd
/home/Me
Me@MY ~
$
the equivalent in Emacs renders (After `M-x my-bash' && pwd) as:
^[]0;~^G
^[[32mMe@MY ^[[33m~^[[0m
$ pwd
/home/Me
$[]0;~^G
^[]0;32mMe@MY ^[[33m~^[[0m
$
... and that is a LOT of noise!
The encoding for *shell-bash* in this scenario shows as multi-byte
iso-latin-1-dos with DOS-style CRLF.
Any help in cleaning this up will be very much appreciated.
Regards
Paul Bibbings
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: GNU Emacs 23.1 and Cygwin bash shell - cleaning up display
2010-02-28 15:54 GNU Emacs 23.1 and Cygwin bash shell - cleaning up display Paul Bibbings
@ 2010-02-28 17:39 ` Pascal J. Bourguignon
2010-02-28 19:16 ` Paul Bibbings
0 siblings, 1 reply; 5+ messages in thread
From: Pascal J. Bourguignon @ 2010-02-28 17:39 UTC (permalink / raw
To: help-gnu-emacs
Paul Bibbings <paul.bibbings@gmail.com> writes:
> the equivalent in Emacs renders (After `M-x my-bash' && pwd) as:
>
> ^[]0;~^G
> ^[[32mMe@MY ^[[33m~^[[0m
> $ pwd
> /home/Me
> $[]0;~^G
> ^[]0;32mMe@MY ^[[33m~^[[0m
> $
>
> ... and that is a LOT of noise!
>
> The encoding for *shell-bash* in this scenario shows as multi-byte
> iso-latin-1-dos with DOS-style CRLF.
>
> Any help in cleaning this up will be very much appreciated.
You may activate ansi-color.
M-x ansi-color-for-comint-mode-on RET
(You may do that automatically in a hook).
However, this deals only with color escapes, not with positionning
escapes or others.
To avoid these, you may change the prompt.
I use:
export PS1='[\u@\h $DISPLAY \W]$ '
in my ~/.bashrc
--
__Pascal Bourguignon__
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: GNU Emacs 23.1 and Cygwin bash shell - cleaning up display
2010-02-28 17:39 ` Pascal J. Bourguignon
@ 2010-02-28 19:16 ` Paul Bibbings
2010-03-01 17:35 ` KARR, DAVID (ATTSI)
0 siblings, 1 reply; 5+ messages in thread
From: Paul Bibbings @ 2010-02-28 19:16 UTC (permalink / raw
To: help-gnu-emacs
pjb@inf...com (Pascal J. Bourguignon) writes:
> Paul Bibbings <paul.bibbings@gmail.com> writes:
>
>> the equivalent in Emacs renders (After `M-x my-bash' && pwd) as:
>>
>> ^[]0;~^G
>> ^[[32mMe@MY ^[[33m~^[[0m
>> $ pwd
>> /home/Me
>> $[]0;~^G
>> ^[]0;32mMe@MY ^[[33m~^[[0m
>> $
>>
>> ... and that is a LOT of noise!
>>
>> The encoding for *shell-bash* in this scenario shows as multi-byte
>> iso-latin-1-dos with DOS-style CRLF.
>>
>> Any help in cleaning this up will be very much appreciated.
>
> You may activate ansi-color.
>
> M-x ansi-color-for-comint-mode-on RET
>
> (You may do that automatically in a hook).
> However, this deals only with color escapes, not with positionning
> escapes or others.
> To avoid these, you may change the prompt.
> I use:
>
> export PS1='[\u@\h $DISPLAY \W]$ '
>
> in my ~/.bashrc
This is great, Pascal. Thanks for this. I have managed to get rid of
the noise and, also, it triggered me to discover that, having recently
moved my HOME directory, I had actually omitted to move over my
.bashrc. Having done so, and made a few modifications, I'm good now!
Regards
Paul Bibbings
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: GNU Emacs 23.1 and Cygwin bash shell - cleaning up display
2010-02-28 19:16 ` Paul Bibbings
@ 2010-03-01 17:35 ` KARR, DAVID (ATTSI)
2010-03-04 15:22 ` J. David Boyd
0 siblings, 1 reply; 5+ messages in thread
From: KARR, DAVID (ATTSI) @ 2010-03-01 17:35 UTC (permalink / raw
To: Paul Bibbings, help-gnu-emacs
> -----Original Message-----
> From: help-gnu-emacs-bounces+dk068x=att.com@gnu.org [mailto:help-gnu-
> emacs-bounces+dk068x=att.com@gnu.org] On Behalf Of Paul Bibbings
> Sent: Sunday, February 28, 2010 11:17 AM
> To: help-gnu-emacs@gnu.org
> Subject: Re: GNU Emacs 23.1 and Cygwin bash shell - cleaning up
display
>
> pjb@inf...com (Pascal J. Bourguignon) writes:
> > Paul Bibbings <paul.bibbings@gmail.com> writes:
> >
> >> the equivalent in Emacs renders (After `M-x my-bash' && pwd) as:
> >>
> >> ^[]0;~^G
> >> ^[[32mMe@MY ^[[33m~^[[0m
> >> $ pwd
> >> /home/Me
> >> $[]0;~^G
> >> ^[]0;32mMe@MY ^[[33m~^[[0m
> >> $
> >>
> >> ... and that is a LOT of noise!
You can create a $HOME/.emacs_bash file, which is used for alternative
settings with Bash in Emacs. With this, you can set a different prompt
in Emacs than outside of Emacs.
> >>
> >> The encoding for *shell-bash* in this scenario shows as multi-byte
> >> iso-latin-1-dos with DOS-style CRLF.
> >>
> >> Any help in cleaning this up will be very much appreciated.
> >
> > You may activate ansi-color.
> >
> > M-x ansi-color-for-comint-mode-on RET
> >
> > (You may do that automatically in a hook).
> > However, this deals only with color escapes, not with positionning
> > escapes or others.
> > To avoid these, you may change the prompt.
> > I use:
> >
> > export PS1='[\u@\h $DISPLAY \W]$ '
> >
> > in my ~/.bashrc
>
> This is great, Pascal. Thanks for this. I have managed to get rid of
> the noise and, also, it triggered me to discover that, having recently
> moved my HOME directory, I had actually omitted to move over my
> .bashrc. Having done so, and made a few modifications, I'm good now!
>
> Regards
>
> Paul Bibbings
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: GNU Emacs 23.1 and Cygwin bash shell - cleaning up display
2010-03-01 17:35 ` KARR, DAVID (ATTSI)
@ 2010-03-04 15:22 ` J. David Boyd
0 siblings, 0 replies; 5+ messages in thread
From: J. David Boyd @ 2010-03-04 15:22 UTC (permalink / raw
To: help-gnu-emacs
"KARR, DAVID (ATTSI)" <dk068x@att.com> writes:
Creating my own .emacs_bash file is exactly what I did. Looks like
this:
-------------------------------------------
. ~/.bashrc
PS1='\[\e[34m\]\u@\h \[\e[35m\]\w\[\e[0m\]\n\$ '
export PS1
-------------------------------------------
Works great too!
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-03-04 15:22 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-28 15:54 GNU Emacs 23.1 and Cygwin bash shell - cleaning up display Paul Bibbings
2010-02-28 17:39 ` Pascal J. Bourguignon
2010-02-28 19:16 ` Paul Bibbings
2010-03-01 17:35 ` KARR, DAVID (ATTSI)
2010-03-04 15:22 ` J. David Boyd
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.