253 |
253 |
254 (defvar my-use-windows-shell nil |
254 (defvar my-use-windows-shell nil |
255 "If t 'cmdproxy.exe' will be used as shell. Affect on M-x shell like |
255 "If t 'cmdproxy.exe' will be used as shell. Affect on M-x shell like |
256 commands. If nil, 'sh' will be used." ) |
256 commands. If nil, 'sh' will be used." ) |
257 |
257 |
|
258 (defun follow-cygwin-symlink () |
|
259 "Follow new-style (and also UCS-16) Cygwin symlinks." |
|
260 (save-excursion |
|
261 (goto-char 0) |
|
262 (when (looking-at "!<symlink>\xff\xfe") |
|
263 (find-alternate-file |
|
264 (substring |
|
265 (decode-coding-string |
|
266 (buffer-substring (match-end 0) (point-max)) |
|
267 'utf-16-le) |
|
268 0 -1) ; -1 for stripping final \0. |
|
269 )))) |
|
270 |
258 (when (eq system-type 'windows-nt) |
271 (when (eq system-type 'windows-nt) |
259 (ignore-errors |
272 (ignore-errors |
260 (require 'cygwin-mount) |
273 (require 'cygwin-mount) |
261 (cygwin-mount-activate) |
274 (cygwin-mount-activate) |
262 ) |
275 ) |
|
276 (add-hook 'find-file-hooks 'follow-cygwin-symlink) |
263 ;; Workaround for Cygwin shell, when set 'CYGWIN=noglob'. By default 'shell-quote-argument' |
277 ;; Workaround for Cygwin shell, when set 'CYGWIN=noglob'. By default 'shell-quote-argument' |
264 ;; quoted by double '\' chars this cause failure. |
278 ;; quoted by double '\' chars this cause failure. |
265 (defun shell-quote-argument (argument) |
279 (defun shell-quote-argument (argument) |
266 (concat "'" argument "'") |
280 (concat "'" argument "'") |
267 ) |
281 ) |