On 2018-05-04 02:04, Michael Albinus wrote: > Furthermore, I wouldn't hard-code "ssh". People might have other > preferences, and on some systems it doesn't work. Think about Emacs > running on MS WIndows, where "plink" is used instead of "ssh". Just > take > "-" as method, this is a notation to apply user's default (Tramp) > method. Revised patch attached to use the "-" pseudo method. > I believe it is always save to use term-ansi-at-user. There's no need > to check, whether it is equal to (user-real-login-name). I've not changed this. The code is evidentially deciding whether the user/host pair being tracked in the shell in the term buffer is a match for the user/host pair known locally to Emacs. Unless both of those components match, a tramp path is created. I've not tested the case of a different user on the local host, but it seems like reasonable logic to me, at first look. (if (and (string= term-ansi-at-host (system-name)) (string= term-ansi-at-user (user-real-login-name))) ;; Use a local path ;; Use a tramp path