help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

GNU Emacs 23.1 and Cygwin bash shell - cleaning up display


From: Paul Bibbings
Subject: GNU Emacs 23.1 and Cygwin bash shell - cleaning up display
Date: Sun, 28 Feb 2010 15:54:37 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (windows-nt)

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

   address@hidden ~
   $ pwd
   /home/Me

   address@hidden ~
   $

the equivalent in Emacs renders (After `M-x my-bash' && pwd) as:

   ^[]0;~^G
   address@hidden ^[[33m~^[[0m
   $ pwd
   /home/Me
   $[]0;~^G
   ^[]0;address@hidden ^[[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 via email to

[Prev in Thread] Current Thread [Next in Thread]