Function: tramp-local-host-p
tramp-local-host-p is a byte-compiled function defined in tramp.el.gz.
Signature
(tramp-local-host-p VEC)
Documentation
Return t if this points to the local host, nil otherwise.
This handles also chrooted environments, which are not regarded as local.
Source Code
;; Defined in /usr/src/emacs/lisp/net/tramp.el.gz
(defun tramp-local-host-p (vec)
"Return t if this points to the local host, nil otherwise.
This handles also chrooted environments, which are not regarded as local."
(let ((host (tramp-file-name-host vec))
(port (tramp-file-name-port vec)))
(and
(stringp tramp-local-host-regexp) (stringp host)
(string-match-p tramp-local-host-regexp host)
;; A port is an indication for an ssh tunnel or alike.
(null port)
;; The method shall be applied to one of the shell file name
;; handlers. `tramp-local-host-p' is also called for "smb" and
;; alike, where it must fail.
(tramp-sh-file-name-handler-p vec)
;; Direct actions aren't possible for encrypted directories.
(null tramp-crypt-enabled)
;; The local temp directory must be writable for the other user.
(file-writable-p
(tramp-make-tramp-file-name vec tramp-compat-temporary-file-directory))
;; On some systems, chown runs only for root.
(or (zerop (user-uid))
(= (tramp-get-remote-uid vec 'integer) tramp-root-id-integer)))))