From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Paul Bibbings Newsgroups: gmane.emacs.help Subject: GNU Emacs 23.1 and Cygwin bash shell - cleaning up display Date: Sun, 28 Feb 2010 15:54:37 +0000 Organization: A noiseless patient Spider Message-ID: <87k4txwe2q.fsf@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1267396539 28374 80.91.229.12 (28 Feb 2010 22:35:39 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 28 Feb 2010 22:35:39 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Feb 28 23:35:32 2010 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1NlrjX-0003d0-Nz for geh-help-gnu-emacs@m.gmane.org; Sun, 28 Feb 2010 23:35:32 +0100 Original-Received: from localhost ([127.0.0.1]:42949 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NlrjX-0004bq-6v for geh-help-gnu-emacs@m.gmane.org; Sun, 28 Feb 2010 17:35:31 -0500 Original-Path: news.stanford.edu!usenet.stanford.edu!newsfeed.esat.net!feeder.news.heanet.ie!feeder.erje.net!feeder.eternal-september.org!eternal-september.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 70 Injection-Date: Sun, 28 Feb 2010 15:54:41 +0000 (UTC) Injection-Info: news.motzarella.org; posting-host="sxQz2bAqvoRS3N7JeKHRCQ"; logging-data="23342"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+MaVPDjnlOBJsLhGgRhMYiu9Ok+dJveF0=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (windows-nt) X-Antivirus-Status: Clean X-Antivirus: avast! (VPS 100227-2, 27/02/2010), Outbound message Cancel-Lock: sha1:dQHtBTn6RsOufZw+CtPgvzx0GrM= sha1:UmsTjWQRTIWsRAdrcRDNPmHmDbA= Original-Xref: news.stanford.edu gnu.emacs.help:177195 X-Mailman-Approved-At: Sun, 28 Feb 2010 17:30:34 -0500 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:72247 Archived-At: 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