Function: tramp-get-completion-user-host

tramp-get-completion-user-host is a byte-compiled function defined in tramp.el.gz.

Signature

(tramp-get-completion-user-host METHOD PARTIAL-USER PARTIAL-HOST USER HOST)

Documentation

Return the most expanded string for user and host name completion.

PARTIAL-USER must match USER, PARTIAL-HOST must match HOST.

Source Code

;; Defined in /usr/src/emacs/lisp/net/tramp.el.gz
;; Compares partial user and host names with possible completions.
(defun tramp-get-completion-user-host
  (method partial-user partial-host user host)
  "Return the most expanded string for user and host name completion.
PARTIAL-USER must match USER, PARTIAL-HOST must match HOST."
  (cond

   ((and partial-user partial-host)
    (if	(and host (string-prefix-p partial-host host)
	     (string-equal partial-user (or user partial-user)))
	(setq user partial-user)
      (setq user nil
	    host nil)))

   (partial-user
    (setq host nil)
    (unless (and user (string-prefix-p partial-user user))
      (setq user nil)))

   (partial-host
    (setq user nil)
    (unless (and host (string-prefix-p partial-host host))
      (setq host nil)))

   (t (setq user nil
	    host nil)))

  (unless (zerop (+ (length user) (length host)))
    (tramp-completion-make-tramp-file-name method user host nil)))