diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2008-02-06 14:43:05 +0000 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2008-02-06 14:43:05 +0000 |
commit | 791fe18237052bcaf174add03e55b8abff4e9751 (patch) | |
tree | 86715a867068fb52a92b47855b8580832e772ef7 /lisp/url | |
parent | da7d7c21f19f0af17f9d990d0a3014c252090da1 (diff) | |
download | emacs-791fe18237052bcaf174add03e55b8abff4e9751.tar.gz |
(url-handler-unhandled-file-name-directory):
Handle `file' URLs specially. Return nil for non-local filenames.
Diffstat (limited to 'lisp/url')
-rw-r--r-- | lisp/url/ChangeLog | 5 | ||||
-rw-r--r-- | lisp/url/url-handlers.el | 15 |
2 files changed, 15 insertions, 5 deletions
diff --git a/lisp/url/ChangeLog b/lisp/url/ChangeLog index 784e8d5c320..11f99ec5280 100644 --- a/lisp/url/ChangeLog +++ b/lisp/url/ChangeLog @@ -1,3 +1,8 @@ +2008-02-06 Stefan Monnier <monnier@iro.umontreal.ca> + + * url-handlers.el (url-handler-unhandled-file-name-directory): + Handle `file' URLs specially. Return nil for non-local filenames. + 2008-02-04 Magnus Henoch <mange@freemail.hu> * url-expand.el: Require cl when compiling, for setf. diff --git a/lisp/url/url-handlers.el b/lisp/url/url-handlers.el index acc85b939a1..088e7a6a534 100644 --- a/lisp/url/url-handlers.el +++ b/lisp/url/url-handlers.el @@ -183,11 +183,16 @@ the arguments that would have been passed to OPERATION." (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 |