From ca1132ae5ea76de9e7122d61eb96f3a95fcce04f Mon Sep 17 00:00:00 2001 From: Oleg Pykhalov Date: Mon, 13 May 2019 02:45:00 +0300 Subject: terminal-here.el: Implement cd to directory after sudo. * terminal-here.el (terminal-here-launch): Implement cd to directory after sudo. --- terminal-here.el | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/terminal-here.el b/terminal-here.el index 15c924d..3d1252c 100644 --- a/terminal-here.el +++ b/terminal-here.el @@ -240,7 +240,10 @@ changed it by running `cd'." (when multiplexer (terminal-here-not-null-symbol terminal-here-multiplexer)) (if (and (string-prefix-p "/ssh:" directory) (s-contains? "|" directory)) - (let ((ssh+sudo (split-string directory "|"))) + (let* ((ssh+sudo (split-string directory "|")) + (user (car (split-string (nth 1 (split-string (cadr ssh+sudo) ":")) + "@"))) + (directory (nth 2 (split-string (cadr ssh+sudo) ":")))) (terminal-here-launch-in-directory (mapconcat 'identity (list "/ssh:" (cadr (split-string (car ssh+sudo) ":")) @@ -248,8 +251,7 @@ changed it by running `cd'." "") multiplexer) (start-process "xdotool" nil (expand-file-name "~/bin/sudo-to-user-web") - (car (split-string (nth 1 (split-string (cadr ssh+sudo) ":")) - "@")))) + user directory)) (terminal-here-launch-in-directory directory multiplexer))) ;;;###autoload -- cgit v1.2.3