Move code for shell setup to proper place. Remove unused code as I do not use
authorOleksandr Gavenko <gavenkoa@gmail.com>
Fri, 05 Aug 2011 16:34:43 +0300
changeset 676 0accf646e451
parent 675 7bef62461084
child 677 154f402aa2dc
Move code for shell setup to proper place. Remove unused code as I do not use Emacs on Windows without Cygwin.
.emacs-my
--- a/.emacs-my	Fri Aug 05 15:39:31 2011 +0300
+++ b/.emacs-my	Fri Aug 05 16:34:43 2011 +0300
@@ -240,13 +240,34 @@
 (setq inhibit-startup-message t)
 
 ;; ----------------------------------------------------------------
-(message "Cygwin, MSYS")
+(message "shell, bash, Cygwin, MSYS")
 
-(when (eq window-system 'w32)
+(defvar my-use-windows-shell nil
+  "If t 'cmdproxy.exe' will be used as shell. Affect on M-x shell like
+  commands. If nil, 'sh' will be used." )
+
+(when (eq system-type 'windows-nt)
   (ignore-errors
     (require 'cygwin-mount)
     (cygwin-mount-activate)
-  ))
+    )
+  ;; Workaround for Cygwin shell, when set 'CYGWIN=noglob'. By default 'shell-quote-argument'
+  ;; quoted by double '\' chars this cause failure.
+  (defun shell-quote-argument (argument)
+    (concat "'" argument "'")
+    )
+  ;; Workaround for Cygwin when 'shell-file-name' is 'bash'.
+  (setq null-device "/dev/null")
+  ;; Use shell from Cygwin/MinGW.
+  (setq shell-file-name "bash")
+  (setenv "SHELL" "/bin/bash")
+  (modify-coding-system-alist 'process "bash" '(cp1251-unix . cp1251-unix))
+  )
+
+(ansi-color-for-comint-mode-on)
+
+(setq explicit-bash-args '("-i"))
+(setq explicit-sh-args '("-i"))
 
 ;;; ----------------------------------------------------------------
 (message "whitespaces")
@@ -397,17 +418,6 @@
 ;;; ----------------------------------------------------------------
 (message "grep, find")
 
-;; This settings have effect from Emacs 22.x.
-(when (eq system-type 'windows-nt)
-  ;; Workaround for Cygwin shell, when set 'CYGWIN=noglob'. By default 'shell-quote-argument'
-  ;; quoted by double '\' chars this cause failure.
-  (defun shell-quote-argument (argument)
-    (concat "'" argument "'")
-    )
-  ;; Workaround for Cygwin when 'shell-file-name' is 'bash'.
-  (setq null-device "/dev/null")
-  )
-
 ;; -ls produce very noisy output:
 ;; (setq find-ls-option '("-ls" . ""))
 ;; So I use next expression, which work with GNU find, I replace %s with '0'
@@ -892,44 +902,6 @@
 (setq comint-eol-on-send t)
 
 ;;; ----------------------------------------------------------------
-(message "shell, sh, bash")
-
-;; Setup Emacs to run bash as its primary shell.
-;; (setq binary-process-input t)
-;; (setq shell-file-name "bash")
-;; (setq shell-command-switch "-c")
-;; (setenv "SHELL" shell-file-name)
-
-(ansi-color-for-comint-mode-on)
-
-(defvar my-use-windows-shell nil
-  "If t 'cmdproxy.exe' will be used as shell. Affect on M-x shell like
-  commands. If nil, 'sh' will be used." )
-
-(when (eq window-system 'w32)           ; may require Cygwin or MSYS
-  (if my-use-windows-shell
-      (progn
-       ;; Restore shell name if user set SHELL env var for Cygwin/MSYS.
-       (setq shell-file-name (concat exec-directory "cmdproxy.exe"))
-       ;; Here is workaround: when explicit-shell-file-name is "bash" and shell-file-name is "cmdproxy.exe"
-       ;; find-dired incorrect quote args (in shell-quote-argument (w32-shell-name) return "bash", but
-       ;; shell-command used shell-file-name which value "cmdproxy.exe"). So I put additional space in pattern to
-       ;; prevent quoting.
-       (setq find-ls-option '("-exec ls -ld {}  ;" . "-ld"))
-       )
-    (progn
-     ;; Use shell from Cygwin/MinGW.
-     (setq shell-file-name "bash")
-     (setenv "SHELL" "/bin/bash")
-     (modify-coding-system-alist 'process "bash" '(cp1251-unix . cp1251-unix))
-     )
-    )
-  ;; (setq explicit-shell-file-name "bash")
-  (setq explicit-bash-args '("-i"))
-  (setq explicit-sh-args '("-i"))
-  )
-
-;;; ----------------------------------------------------------------
 (message "spell, ispell, aspell")
 
 ;; Settings for spelling done in '.emacs-autogen'.