.emacs-my
changeset 676 0accf646e451
parent 675 7bef62461084
child 677 154f402aa2dc
equal deleted inserted replaced
675:7bef62461084 676:0accf646e451
   238 
   238 
   239 ;; (setq inhibit-splash-screen t) ; nonexist on 21.4.1
   239 ;; (setq inhibit-splash-screen t) ; nonexist on 21.4.1
   240 (setq inhibit-startup-message t)
   240 (setq inhibit-startup-message t)
   241 
   241 
   242 ;; ----------------------------------------------------------------
   242 ;; ----------------------------------------------------------------
   243 (message "Cygwin, MSYS")
   243 (message "shell, bash, Cygwin, MSYS")
   244 
   244 
   245 (when (eq window-system 'w32)
   245 (defvar my-use-windows-shell nil
       
   246   "If t 'cmdproxy.exe' will be used as shell. Affect on M-x shell like
       
   247   commands. If nil, 'sh' will be used." )
       
   248 
       
   249 (when (eq system-type 'windows-nt)
   246   (ignore-errors
   250   (ignore-errors
   247     (require 'cygwin-mount)
   251     (require 'cygwin-mount)
   248     (cygwin-mount-activate)
   252     (cygwin-mount-activate)
   249   ))
   253     )
       
   254   ;; Workaround for Cygwin shell, when set 'CYGWIN=noglob'. By default 'shell-quote-argument'
       
   255   ;; quoted by double '\' chars this cause failure.
       
   256   (defun shell-quote-argument (argument)
       
   257     (concat "'" argument "'")
       
   258     )
       
   259   ;; Workaround for Cygwin when 'shell-file-name' is 'bash'.
       
   260   (setq null-device "/dev/null")
       
   261   ;; Use shell from Cygwin/MinGW.
       
   262   (setq shell-file-name "bash")
       
   263   (setenv "SHELL" "/bin/bash")
       
   264   (modify-coding-system-alist 'process "bash" '(cp1251-unix . cp1251-unix))
       
   265   )
       
   266 
       
   267 (ansi-color-for-comint-mode-on)
       
   268 
       
   269 (setq explicit-bash-args '("-i"))
       
   270 (setq explicit-sh-args '("-i"))
   250 
   271 
   251 ;;; ----------------------------------------------------------------
   272 ;;; ----------------------------------------------------------------
   252 (message "whitespaces")
   273 (message "whitespaces")
   253 
   274 
   254 (setq default-indicate-empty-lines t)
   275 (setq default-indicate-empty-lines t)
   394   )
   415   )
   395 (global-set-key [f7] 'occur)
   416 (global-set-key [f7] 'occur)
   396 
   417 
   397 ;;; ----------------------------------------------------------------
   418 ;;; ----------------------------------------------------------------
   398 (message "grep, find")
   419 (message "grep, find")
   399 
       
   400 ;; This settings have effect from Emacs 22.x.
       
   401 (when (eq system-type 'windows-nt)
       
   402   ;; Workaround for Cygwin shell, when set 'CYGWIN=noglob'. By default 'shell-quote-argument'
       
   403   ;; quoted by double '\' chars this cause failure.
       
   404   (defun shell-quote-argument (argument)
       
   405     (concat "'" argument "'")
       
   406     )
       
   407   ;; Workaround for Cygwin when 'shell-file-name' is 'bash'.
       
   408   (setq null-device "/dev/null")
       
   409   )
       
   410 
   420 
   411 ;; -ls produce very noisy output:
   421 ;; -ls produce very noisy output:
   412 ;; (setq find-ls-option '("-ls" . ""))
   422 ;; (setq find-ls-option '("-ls" . ""))
   413 ;; So I use next expression, which work with GNU find, I replace %s with '0'
   423 ;; So I use next expression, which work with GNU find, I replace %s with '0'
   414 ;; to avoid unnecessary sys calls and this make output aligned by column:
   424 ;; to avoid unnecessary sys calls and this make output aligned by column:
   888 
   898 
   889 ;; If non-nil, add a `/' to completed directories, ` ' to file names.
   899 ;; If non-nil, add a `/' to completed directories, ` ' to file names.
   890 (setq comint-completion-addsuffix t)
   900 (setq comint-completion-addsuffix t)
   891 ;; Non-nil means go to the end of the line before sending input.
   901 ;; Non-nil means go to the end of the line before sending input.
   892 (setq comint-eol-on-send t)
   902 (setq comint-eol-on-send t)
   893 
       
   894 ;;; ----------------------------------------------------------------
       
   895 (message "shell, sh, bash")
       
   896 
       
   897 ;; Setup Emacs to run bash as its primary shell.
       
   898 ;; (setq binary-process-input t)
       
   899 ;; (setq shell-file-name "bash")
       
   900 ;; (setq shell-command-switch "-c")
       
   901 ;; (setenv "SHELL" shell-file-name)
       
   902 
       
   903 (ansi-color-for-comint-mode-on)
       
   904 
       
   905 (defvar my-use-windows-shell nil
       
   906   "If t 'cmdproxy.exe' will be used as shell. Affect on M-x shell like
       
   907   commands. If nil, 'sh' will be used." )
       
   908 
       
   909 (when (eq window-system 'w32)           ; may require Cygwin or MSYS
       
   910   (if my-use-windows-shell
       
   911       (progn
       
   912        ;; Restore shell name if user set SHELL env var for Cygwin/MSYS.
       
   913        (setq shell-file-name (concat exec-directory "cmdproxy.exe"))
       
   914        ;; Here is workaround: when explicit-shell-file-name is "bash" and shell-file-name is "cmdproxy.exe"
       
   915        ;; find-dired incorrect quote args (in shell-quote-argument (w32-shell-name) return "bash", but
       
   916        ;; shell-command used shell-file-name which value "cmdproxy.exe"). So I put additional space in pattern to
       
   917        ;; prevent quoting.
       
   918        (setq find-ls-option '("-exec ls -ld {}  ;" . "-ld"))
       
   919        )
       
   920     (progn
       
   921      ;; Use shell from Cygwin/MinGW.
       
   922      (setq shell-file-name "bash")
       
   923      (setenv "SHELL" "/bin/bash")
       
   924      (modify-coding-system-alist 'process "bash" '(cp1251-unix . cp1251-unix))
       
   925      )
       
   926     )
       
   927   ;; (setq explicit-shell-file-name "bash")
       
   928   (setq explicit-bash-args '("-i"))
       
   929   (setq explicit-sh-args '("-i"))
       
   930   )
       
   931 
   903 
   932 ;;; ----------------------------------------------------------------
   904 ;;; ----------------------------------------------------------------
   933 (message "spell, ispell, aspell")
   905 (message "spell, ispell, aspell")
   934 
   906 
   935 ;; Settings for spelling done in '.emacs-autogen'.
   907 ;; Settings for spelling done in '.emacs-autogen'.