branch: elpa/exec-path-from-shell
commit 699f41edb31fbd43326dba9e48bb0eb535d0b8c2
Author: Lassi Kortela <[email protected]>
Commit: Lassi Kortela <[email protected]>
Show error if trying to run from a remote buffer
In order to produce sensible results, exec-path-from-shell needs to
run the shell on the same computer where Emacs is running. If we try
to run it on a remote computer, we will likely mess up the local
computer's path or fail to obtain a path altogether.
---
exec-path-from-shell.el | 2 ++
1 file changed, 2 insertions(+)
diff --git a/exec-path-from-shell.el b/exec-path-from-shell.el
index 98692b76c1..0e1879989f 100644
--- a/exec-path-from-shell.el
+++ b/exec-path-from-shell.el
@@ -180,6 +180,8 @@ shell-escaped, so they may contain $ etc."
Execute the shell according to `exec-path-from-shell-arguments'.
The result is a list of (NAME . VALUE) pairs."
+ (when (file-remote-p default-directory)
+ (error "You cannot run exec-path-from-shell from a remote buffer (Tramp,
etc.)"))
(let* ((random-default (md5 (format "%s%s%s" (emacs-pid) (random)
(current-time))))
(dollar-names (mapcar (lambda (n) (format "${%s-%s}" n
random-default)) names))
(values (split-string (exec-path-from-shell-printf