Mercurial > emacs
changeset 91586:cac14d4ce88f
* url-handlers.el (file-remote-p): Add handler.
(url-handler-file-remote-p): New fun.
author | Michael Albinus <michael.albinus@gmx.de> |
---|---|
date | Wed, 06 Feb 2008 20:34:03 +0000 |
parents | 4fe734146ac9 |
children | 46cbed0b179b |
files | lisp/url/url-handlers.el |
diffstat | 1 files changed, 21 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/url/url-handlers.el Wed Feb 06 19:06:34 2008 +0000 +++ b/lisp/url/url-handlers.el Wed Feb 06 20:34:03 2008 +0000 @@ -73,6 +73,7 @@ ;; file-ownership-preserved-p No way to know ;; file-readable-p Finished ;; file-regular-p !directory_p +;; file-remote-p Finished ;; file-symlink-p Needs DAV bindings ;; file-truename Needs DAV bindings ;; file-writable-p Check for LOCK? @@ -151,6 +152,7 @@ (put 'expand-file-name 'url-file-handlers 'url-handler-expand-file-name) (put 'directory-file-name 'url-file-handlers 'url-handler-directory-file-name) (put 'unhandled-file-name-directory 'url-file-handlers 'url-handler-unhandled-file-name-directory) +(put 'file-remote-p 'url-file-handlers 'url-handler-file-remote-p) ;; (put 'file-name-as-directory 'url-file-handlers 'url-handler-file-name-as-directory) ;; These are operations that we do not support yet (DAV!!!) @@ -194,6 +196,25 @@ ;; a local process. nil))) +(defun url-handler-file-remote-p (filename &optional identification connected) + (let ((url (url-generic-parse-url filename))) + (if (and (url-type url) (not (equal (url-type url) "file"))) + ;; Maybe we can find a suitable check for CONNECTED. For now, + ;; we ignore it. + (cond + ((eq identification 'method) (url-type url)) + ((eq identification 'user) (url-user url)) + ((eq identification 'host) (url-host url)) + ((eq identification 'localname) (url-filename url)) + (t (url-recreate-url + (url-parse-make-urlobj (url-type url) (url-user url) nil + (url-host url) (url-port url))))) + ;; If there is no URL type, or it is a "file://" URL, the + ;; filename is expected to be non remote. A more subtle check + ;; for "file://" URLs could be applied, as said in + ;; `url-handler-unhandled-file-name-directory'. + nil))) + ;; The actual implementation ;;;###autoload (defun url-copy-file (url newname &optional ok-if-already-exists keep-time)