Function: tramp-find-method

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

Signature

(tramp-find-method METHOD USER HOST)

Documentation

Return the right method string to use depending on USER and HOST.

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

Source Code

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