reddit / emacs

Tramp ssh hosts completion

AsterOps · 2022-04-06 10:54
Hi, I am using custom structure of `~/.ssh/config` which contains only these lines: Include conf.d/* and keep seperate file for each "site" tree ~/.ssh/conf.d conf.d/ ├── home ├── lab ├── X └── Y host entries in that files are ignored by tramp completion, because it looks for them in `~/.ssh/config` which in my example is empty. I found in the [docs](https://www.gnu.org/software/emacs/manual/html_node/tramp/Customizing-Completion.html) that there is `tramp-completion-function-alist` variable which defines which files parse foreach method but I am not sure about overwriting them. Pls help :)
Phil-Hudson · 2022-04-06 15:29
I think you need to either advise or replace function `tramp-parse-sconfig` to do what it currently does for ~/.ssh/config for each file identified by an `Include` directive.
Phil-Hudson · 2022-04-06 15:35
Come to think of it, this seems like it would be a useful TRAMP enhancement. You should probably raise an RFE with the dev list: `M-x report-emacs-bug`.
AsterOps · 2022-04-06 19:52
Hey, thx for your answers. I found solution by myself. I've added to my tramp configuration following lines ``` (use-package tramp :config (add-to-list 'tramp-completion-function-alist '("ssh" (tramp-parse-sconfig "~/.ssh/conf.d/home") (tramp-parse-sconfig "~/.ssh/conf.d/lab") (tramp-parse-sconfig "~/.ssh/conf.d/X") (tramp-parse-sconfig "~/.ssh/conf.d/Y")))) ``` This will add to `tramp-completion-function-alist` variable my location where I store my ssh hosts and then completion works fine :)
worthless-trash · 2022-04-07 22:28
I think that this is worth filing as a bug, you've got the setup and the domain knowledge to do this. Edit: thank you for sharing the workaround.