P.S. Here is my init.el (setq load-path (cons "~/.xemacs/tnt-2.6" (cons "~/.emacs.d" (cons "~/.emacs.d/tsgates-git-emacs-799d9a8" load-path)))) (custom-set-variables ;; custom-set-variables was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. '(comint-input-ring-file-name "(concat \"d:/My Documents/.history/\" (format-time-string \"%Y%m%d\") \".hist\")") '(cygwin-mount-cygwin-bin-directory "d:/cygwin/bin") '(desktop-save-mode t) '(ediff-cmp-program "d:/cygwin/usr/bin/cmp") '(ediff-custom-diff-program "") '(ediff-diff-program "d:/cygwin/usr/bin/diff") '(explicit-shell-file-name "d:\\cygwin\\bin\\bash.exe") '(gitk-program "/usr/bin/gitk") '(tramp-default-method "scp") '(tramp-encoding-command-switch "-c") '(tramp-encoding-shell "d:/cygwin/usr/bin/bash.exe")) (custom-set-faces ;; custom-set-faces was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. ) ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Initial setup ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; This assumes that Cygwin is installed in C:\cygwin (the ;; default) and that C:\cygwin\bin is not already in your ;; Windows Path (it generally should not be). (setq exec-path (cons "D:/cygwin/bin" exec-path)) (setenv "PATH" (concat "D:\\cygwin\\bin;" (getenv "PATH"))) ;; LOGNAME and USER are expected in many Emacs packages ;; Check these environment variables. (if (and (null (getenv "USER")) ;; Windows includes variable USERNAME, which is copied to ;; LOGNAME and USER respectively. (getenv "USERNAME")) (setenv "USER" (getenv "USERNAME"))) (if (and (getenv "LOGNAME") ;; Bash shell defines only LOGNAME (null (getenv "USER"))) (setenv "USER" (getenv "LOGNAME"))) (if (and (getenv "USER") (null (getenv "LOGNAME"))) (setenv "LOGNAME" (getenv "USER"))) ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; (A) M-x shell: This change M-x shell permanently ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Would call Windows command interpreter. Change it. (setq shell-file-name "bash") (setenv "SHELL" shell-file-name) (setq explicit-shell-file-name shell-file-name) ;; Remove C-m (^M) characters that appear in output (add-hook 'comint-output-filter-functions 'comint-strip-ctrl-m) ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; (B) *OR* call following function with M-x my-bash ;; The M-x shell would continue to run standard Windows shell ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (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]*[$] ?")))) ;(defun my-shell-setup () ;; "For Cygwin bash under Emacs 20" ;; (setq comint-scroll-show-maximum-output 'this) ;; (make-variable-buffer-local 'comint-completion-addsuffix)) ;; (setq comint-completion-addsuffix t) ;; ;; (setq comint-process-echoes t) ;; reported that this is no longer needed ;; (setq comint-eol-on-send t) ;; (setq w32-quote-process-args ?\") ;; (setenv "PID" nil) ;; (setq shell-mode-hook 'my-shell-setup) (require 'cygwin-mount) (cygwin-mount-activate) ;; Already loaded in Emacs23 ;; (load "~/.xemacs/nxml-mode-20041004/rng-auto.el") ;; This seems to screw me up. Besides, it looks old. ;; (load "~/.xemacs/nxhtml-2.08-100425/nxhtml/autostart.el") ;; Could this be the culprit? (load "~/.emacs.d/xquery-mode.el") (server-start) (put 'narrow-to-region 'disabled nil)