# HG changeset patch # User Stefan Monnier # Date 1202308985 0 # Node ID 9c08b66c6c21e8093aa8045aaf1ee19ec076d6ef # Parent 93691642bd78e78bda6620c4bab005fbfeaf98e6 (url-handler-unhandled-file-name-directory): Handle `file' URLs specially. Return nil for non-local filenames. diff -r 93691642bd78 -r 9c08b66c6c21 lisp/url/ChangeLog --- a/lisp/url/ChangeLog Wed Feb 06 12:00:56 2008 +0000 +++ b/lisp/url/ChangeLog Wed Feb 06 14:43:05 2008 +0000 @@ -1,3 +1,8 @@ +2008-02-06 Stefan Monnier + + * url-handlers.el (url-handler-unhandled-file-name-directory): + Handle `file' URLs specially. Return nil for non-local filenames. + 2008-02-04 Magnus Henoch * url-expand.el: Require cl when compiling, for setf. diff -r 93691642bd78 -r 9c08b66c6c21 lisp/url/url-handlers.el --- a/lisp/url/url-handlers.el Wed Feb 06 12:00:56 2008 +0000 +++ b/lisp/url/url-handlers.el Wed Feb 06 14:43:05 2008 +0000 @@ -183,11 +183,16 @@ (url-run-real-handler 'directory-file-name (list dir)))) (defun url-handler-unhandled-file-name-directory (filename) - ;; Copied from tramp.el. This is used as the cwd for subprocesses: - ;; without it running call-process or start-process in a URL directory - ;; signals an error. - ;; FIXME: we can do better if `filename' is a "file://" URL. - (expand-file-name "~/")) + (let ((url (url-generic-parse-url filename))) + (if (equal (url-type url) "file") + ;; `file' URLs are actually local. The filename part may be "" + ;; which really stands for "/". + ;; FIXME: maybe we should check that the host part is "" or "localhost" + ;; or some name that represents the local host? + (or (file-name-directory (url-filename url)) "/") + ;; All other URLs are not expected to be directly accessible from + ;; a local process. + nil))) ;; The actual implementation ;;;###autoload