emacs-devel
[Top][All Lists]
Advanced

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

Re: autoload failure


From: Lennart Borgman
Subject: Re: autoload failure
Date: Mon, 1 Nov 2004 02:46:27 +0100

----- Original Message ----- 
From: "Stefan" <address@hidden>

: >>>>> "Stefan" == Stefan  <address@hidden> writes:
: >> 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,
:
: Has someone tried my patch?

After some small corrections it worked for me with 21.3. Put the code below
in a buffer and do eval-buffer. You should get a buffer visiting
c:\hello.txt. The file name I used in the bottom is an MSYS style file name
(if I remember right at the moment), but the file name pattern should work
for Cygwin style file names too.

Maybe should the the object be renamed to reflect that the code handles MSYS
too?

- Lennart


;;; Try to handle the most common misuses of cygwin paths.
;;(defconst w32-cygdrive-name-regexp "\\`/cygdrive/\\(.\\)/")
(defconst w32-cygdrive-name-regexp "^\\(?:/cygwin\\)?/\\(.\\)/")
;;(defconst w32-cygdrive-name-regexp "^/\\(.\\)/")

(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)
(message "handler %s %s" op args)
(case op
  (expand-file-name
   (let ((file (car args))
  (args (cdr args)))
     (cond
      ((= 0 (string-match w32-cygdrive-name-regexp file))
       (w32-cygdrive-run-real-handler
 op (cons (replace-match "\\1:/" t nil file) args)))
      ((= 0 (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)
(find-file "/c/hello.txt/")








reply via email to

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