all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Paul Bibbings <paul.bibbings@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: GNU Emacs 23.1 and Cygwin bash shell - cleaning up display
Date: Sun, 28 Feb 2010 15:54:37 +0000	[thread overview]
Message-ID: <87k4txwe2q.fsf@gmail.com> (raw)

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


             reply	other threads:[~2010-02-28 15:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-28 15:54 Paul Bibbings [this message]
2010-02-28 17:39 ` GNU Emacs 23.1 and Cygwin bash shell - cleaning up display 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87k4txwe2q.fsf@gmail.com \
    --to=paul.bibbings@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.