Function: tramp-find-user

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

Signature

(tramp-find-user METHOD USER HOST)

Documentation

Return the right user string to use depending on METHOD and HOST.

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

Source Code

;; Defined in /usr/src/emacs/lisp/net/tramp.el.gz
(defun tramp-find-user (method user host)
  "Return the right user string to use depending on METHOD and HOST.
This is USER, if non-nil.  Otherwise, do a lookup in
`tramp-default-user-alist' and `tramp-default-user'."
  (let ((result
	 (or user
	     (let ((choices tramp-default-user-alist)
		   luser 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 host "")))
		   (setq luser (nth 2 item)
			 choices nil)))
	       luser)
	     tramp-default-user)))
    ;; We must mark, whether a default value has been used.
    (if (or user (null result))
	result
      (propertize result 'tramp-default t))))