Fixed a bug in my eshell starter function

This commit is contained in:
Howard Abrams 2023-07-05 09:24:21 -07:00
parent ccb49d5a58
commit 043778da0a

View file

@ -1453,14 +1453,14 @@ Tramp reference can be long when attempting to connect as another user account u
(defun ha-eshell-host->tramp (username hostname &optional prefer-root) (defun ha-eshell-host->tramp (username hostname &optional prefer-root)
"Return a TRAMP reference based on a USERNAME and HOSTNAME "Return a TRAMP reference based on a USERNAME and HOSTNAME
that refers to any host or IP address." that refers to any host or IP address."
(cond ((string-match-p "^/" host) (cond ((string-match-p "^/" hostname)
host) hostname)
((or (and prefer-root (not username)) (equal username "root")) ((or (and prefer-root (not username)) (equal username "root"))
(format "/ssh:%s|sudo:%s:" hostname hostname)) (format "/ssh:%s|sudo:%s:" hostname hostname))
((or (null username) (equal username user-login-name)) ((or (null username) (equal username user-login-name))
(format "/ssh:%s:" hostname)) (format "/ssh:%s:" hostname))
(t (t
(format "/ssh:%s|sudo:%s|sudo@%s:%s:" hostname hostname username hostname)))) (format "/ssh:%s@%s:" username hostname))))
#+end_src #+end_src
This function pulls it all together: This function pulls it all together: