[emacs-berlin] Tramp mode with custom location for SSH config
Michael Albinus
michael.albinus at gmx.de
Sun Mar 12 16:32:29 UTC 2023
jman <emacs-berlin at city17.xyz> writes:
Hi,
> It works great! For the record, I have added the following
> snippet to my Emacs config:
>
> (add-to-list 'tramp-methods
> '("ssh-j" ;; LOL slight variation for the "ssh" method
> (tramp-login-program "ssh")
> (tramp-login-args
> (("-F" "$XDG_CONFIG_HOME/ssh/config")
> ("-l" "%u")
> ("-p" "%p")
> ("%c")
> ("-e" "none")
> ("%h")))
> (tramp-async-args
> (("-q")))
> (tramp-direct-async t)
> (tramp-remote-shell "/bin/sh")
> (tramp-remote-shell-login
> ("-l"))
> (tramp-remote-shell-args
> ("-c"))))
>
>
> Just one minor wrinkle since I am not great lisper. For the additional
> "-F" parameter I wanted to use:
>
> ("-F" (concat (getenv "XDG_CONFIG_HOME") "/ssh/config"))
>
> it is successfully evaluated (C-x C-e), but then TRAMP returns this error:
>
> (wrong-type-argument "char-or-string-p (concat (getenv XDG_CONFIG_HOME) /ssh/config)"
>
> Why?
It is a quoted list, see the leading apostrophe in '(ssh ...
If you want to have it evaluated, you would need
--8<---------------cut here---------------start------------->8---
(add-to-list 'tramp-methods
`("ssh-j" ;; LOL slight variation for the "ssh" method
(tramp-login-program "ssh")
(tramp-login-args
(("-F" ,(concat (getenv "XDG_CONFIG_HOME") "/ssh/config"))
...
--8<---------------cut here---------------end--------------->8---
Best regards, Michael.
More information about the emacs-berlin
mailing list