Function: tramp-handle-file-remote-p

tramp-handle-file-remote-p is a byte-compiled function defined in tramp.el.gz.

Signature

(tramp-handle-file-remote-p FILENAME &optional IDENTIFICATION CONNECTED)

Documentation

Like file-remote-p for Tramp files.

Source Code

;; Defined in /usr/src/emacs/lisp/net/tramp.el.gz
(defun tramp-handle-file-remote-p (filename &optional identification connected)
  "Like `file-remote-p' for Tramp files."
  ;; We do not want traces in the debug buffer.
  (let ((tramp-verbose (min tramp-verbose 3)))
    (when (tramp-tramp-file-p filename)
      (let* ((o (tramp-dissect-file-name filename))
	     (p (tramp-get-connection-process o))
	     (c (and (process-live-p p)
		     (tramp-get-connection-property p "connected"))))
	;; We expand the file name only, if there is already a connection.
	(with-parsed-tramp-file-name
	    (if c (expand-file-name filename) filename) nil
	  (and (or (not connected) c)
	       (cond
		((eq identification 'method) method)
		;; Domain and port are appended to user and host,
		;; respectively.
		((eq identification 'user) (tramp-file-name-user-domain v))
		((eq identification 'host) (tramp-file-name-host-port v))
		((eq identification 'localname) localname)
		;; Hop exists only in original dissected file name.
		((eq identification 'hop) (tramp-file-name-hop o))
		(t (tramp-make-tramp-file-name v 'noloc)))))))))