Function: url-tramp-convert-url-to-tramp

url-tramp-convert-url-to-tramp is an autoloaded and byte-compiled function defined in url-tramp.el.gz.

Signature

(url-tramp-convert-url-to-tramp URL)

Documentation

Convert URL to a Tramp file name.

If URL contains a password, it will be added to the password-data cache. In case URL is not convertible, nil is returned.

Source Code

;; Defined in /usr/src/emacs/lisp/url/url-tramp.el.gz
(defun url-tramp-convert-url-to-tramp (url)
  "Convert URL to a Tramp file name.
If URL contains a password, it will be added to the `password-data' cache.
In case URL is not convertible, nil is returned."
  (let* ((obj (url-generic-parse-url (and (stringp url) url)))
         (port
          (and obj (natnump (url-portspec obj))
               (number-to-string (url-portspec obj)))))
    (if (and obj (member (url-type obj) url-tramp-protocols))
        (progn
          (when (url-password obj)
	    (password-cache-add
	     (tramp-make-tramp-file-name
              (make-tramp-file-name
	       :method (url-type obj) :user (url-user obj)
               :host (url-host obj)))
	     (url-password obj)))
          (tramp-make-tramp-file-name
           (make-tramp-file-name
            :method (url-type obj) :user (url-user obj)
            :host (url-host obj) :port port :localname (url-filename obj))))
      url)))