emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: autoload failure


From: Stefan
Subject: Re: autoload failure
Date: Sat, 30 Oct 2004 13:42:22 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/21.3.50 (darwin)

> The path "/cygdrive/d/pub/emacs" is not valid on Windows.  It is an
> indication that you are using Cygwin make, which the docs explicitly
> say to avoid for this reason.

I really think it would be more constructive to add a file-name-handler
for "/cygdrive/" seeing how common this kind of problem is (it might at
least save us some time replying to such email).

Something like the 100% untested patch below,


        Stefan


--- orig/lisp/w32-fns.el
+++ mod/lisp/w32-fns.el
@@ -34,6 +34,8 @@
 
 ;;; Code:
 
+(eval-when-compile (require 'cl))
+
 ;; Map delete and backspace
 (define-key function-key-map [backspace] "\177")
 (define-key function-key-map [delete] "\C-d")
@@ -257,6 +259,37 @@
        (setq start (match-end 0))))
     name))
 
+;;; Try to handle the most common misuses of cygwin paths.
+(defconst w32-cygdrive-name-regexp "\\`/cygdrive/\\(.\\)/")
+
+(defun w32-cygdrive-run-real-handler (op args)
+  (let ((inhibit-file-name-handlers
+        (cons 'w32-cygdrive-name-handler
+              (if (eq inhibit-file-name-operation op)
+                  inhibit-file-name-handlers)))
+       (inhibit-file-name-operation op))
+    (apply op args))))
+
+(defun w32-cygdrive-name-handler (op &rest args)
+  (case op
+    (expand-file-name
+     (let ((file (car args)))
+       (cond
+       ((string-match w32-cygdrive-name-regexp file)
+        (w32-cygdrive-run-real-handler
+         op (cons (replace-match "\\1:/" t nil file) args)))
+       ((string-match w32-cygdrive-name-regexp (car args))
+        (w32-cygdrive-run-real-handler
+         op (list* file (replace-match "\\1:/" t nil (car args))
+                   (cdr args))))
+       ;; This is actually an error (we should never get here),
+       ;; but let's be defensive.
+       (t (w32-cygdrive-run-real-handler op args)))))
+    (t (w32-cygdrive-run-real-handler op args))))
+
+(push (cons w32-cygdrive-name-regexp 'w32-cygdrive-name-handler)
+      file-name-handler-alist)
+
 ;;; Fix interface to (X-specific) mouse.el
 (defun x-set-selection (type data)
   (or type (setq type 'PRIMARY))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]