Function: tramp-find-host

tramp-find-host is a byte-compiled function defined in tramp.el.gz.

Signature

(tramp-find-host METHOD USER HOST)

Documentation

Return the right host string to use depending on METHOD and USER.

This is HOST, if non-nil. Otherwise, do a lookup in tramp-default-host-alist and tramp-default-host.

Source Code

;; Defined in /usr/src/emacs/lisp/net/tramp.el.gz
(defun tramp-find-host (method user host)
  "Return the right host string to use depending on METHOD and USER.
This is HOST, if non-nil.  Otherwise, do a lookup in
`tramp-default-host-alist' and `tramp-default-host'."
  (declare (tramp-suppress-trace t))
  (let ((result
	 (or (and (length> host 0) host)
	     (let ((choices tramp-default-host-alist)
		   lhost item)
	       (while choices
		 (setq item (pop choices))
		 (when (and (string-match-p (or (nth 0 item) "") (or method ""))
			    (string-match-p (or (nth 1 item) "") (or user "")))
		   (setq lhost (nth 2 item)
			 choices nil)))
	       lhost)
	     tramp-default-host)))
    ;; We must mark, whether a default value has been used.
    (if (or (length> host 0) (null result))
	result
      (propertize result 'tramp-default t))))