From ff44eddde558dc9dd1c93810406f9ab442de9448 Mon Sep 17 00:00:00 2001 From: Tino Calancha Date: Fri, 12 Nov 2021 17:24:32 +0100 Subject: [PATCH] Customization of docker-tramp-docker-executable updates tramp-methods At creation, `docker-tramp-method' uses the value of `docker-tramp-docker-executable': a customization of the later should be propagated to the former. * docker-tramp.el (docker-tramp--update-method): Add helper function. (docker-tramp-docker-executable): Set custom-set property to a function that also updates docker-tramp-method. --- docker-tramp.el | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docker-tramp.el b/docker-tramp.el index fdad700..867a0b1 100644 --- a/docker-tramp.el +++ b/docker-tramp.el @@ -164,6 +164,19 @@ to connect to the default user containers." (tramp-remote-shell "/bin/sh") (tramp-remote-shell-args ("-i" "-c"))))) +(defun docker-tramp--update-method () + "Update docker tramp method." + (let (it) + (while (setq it (assoc docker-tramp-method tramp-methods)) + (setq tramp-methods (delq it tramp-methods)))) + (docker-tramp-add-method)) + +;; Customization of `docker-tramp-docker-executable' updates `docker-tramp-method' +(put 'docker-tramp-docker-executable 'custom-set + (lambda (sym val) + (custom-set-default sym val) + (docker-tramp--update-method))) + ;;;###autoload (eval-after-load 'tramp '(progn