438 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
438 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
439 (message "shell, bash, Cygwin, MSYS") |
439 (message "shell, bash, Cygwin, MSYS") |
440 |
440 |
441 (eval-when 'compile (require 'shell)) |
441 (eval-when 'compile (require 'shell)) |
442 |
442 |
443 ;; Activate Cygwin for native Windows Emacs if available. |
|
444 (when (and (eq system-type 'windows-nt) (require 'cygwin-mount nil t)) |
|
445 (cygwin-mount-activate)) |
|
446 |
|
447 (defvar my-use-windows-shell nil |
443 (defvar my-use-windows-shell nil |
448 "If t 'cmdproxy.exe' will be used as shell. |
444 "If t 'cmdproxy.exe' will be used as shell. |
449 Affect on \\[shell] like commands. If nil, 'sh' will be used." ) |
445 Affect on \\[shell] like commands. If nil, 'sh' will be used." ) |
450 |
446 |
451 (defun follow-cygwin-symlink () |
447 (defun follow-cygwin-symlink () |
475 (setq table nil) |
471 (setq table nil) |
476 ) ) |
472 ) ) |
477 path |
473 path |
478 )) |
474 )) |
479 |
475 |
|
476 ;; Activate Cygwin for native Windows Emacs if available. |
480 (when (eq system-type 'windows-nt) |
477 (when (eq system-type 'windows-nt) |
481 (ignore-errors |
478 (ignore-errors |
482 (require 'cygwin-mount) |
479 (require 'cygwin-mount) |
483 (cygwin-mount-activate) |
480 (cygwin-mount-activate)) |
484 ) |
|
485 (add-hook 'find-file-hook 'follow-cygwin-symlink) |
481 (add-hook 'find-file-hook 'follow-cygwin-symlink) |
486 ;; Workaround for Cygwin shell, when set 'CYGWIN=noglob'. By default 'shell-quote-argument' |
482 ;; Workaround for Cygwin shell, when set 'CYGWIN=noglob'. By default 'shell-quote-argument' |
487 ;; quoted by double '\' chars this cause failure. |
483 ;; quoted by double '\' chars this cause failure. |
488 (defun shell-quote-argument (argument) |
484 (defun shell-quote-argument (argument) |
489 (concat "'" argument "'") |
485 (concat "'" argument "'")) |
490 ) |
|
491 ;; Workaround for Cygwin when 'shell-file-name' is 'bash'. |
486 ;; Workaround for Cygwin when 'shell-file-name' is 'bash'. |
492 (setq null-device "/dev/null") |
487 (setq null-device "/dev/null") |
493 ;; Use shell from Cygwin/MinGW. |
488 ;; Use shell from Cygwin/MinGW. |
494 (setq shell-file-name "bash") |
489 (setq shell-file-name "bash") |
495 (setenv "SHELL" "/bin/bash") |
490 (setenv "SHELL" "/bin/bash") |