# HG changeset patch # User Oleksandr Gavenko # Date 1317333709 -10800 # Node ID 2cb49be54b21cf3e1f235667924e2ae910287573 # Parent 659c1d14b849ee6343fe248c360fbafefc619dd9 Follow new-style (and also UCS-16) Cygwin symlinks. diff -r 659c1d14b849 -r 2cb49be54b21 .emacs-my --- a/.emacs-my Tue Sep 27 10:37:34 2011 +0300 +++ b/.emacs-my Fri Sep 30 01:01:49 2011 +0300 @@ -255,11 +255,25 @@ "If t 'cmdproxy.exe' will be used as shell. Affect on M-x shell like commands. If nil, 'sh' will be used." ) +(defun follow-cygwin-symlink () + "Follow new-style (and also UCS-16) Cygwin symlinks." + (save-excursion + (goto-char 0) + (when (looking-at "!\xff\xfe") + (find-alternate-file + (substring + (decode-coding-string + (buffer-substring (match-end 0) (point-max)) + 'utf-16-le) + 0 -1) ; -1 for stripping final \0. + )))) + (when (eq system-type 'windows-nt) (ignore-errors (require 'cygwin-mount) (cygwin-mount-activate) ) + (add-hook 'find-file-hooks 'follow-cygwin-symlink) ;; 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)