From ec5145d68462c93fd4b4ab3c6aa6b01b7c3d3902 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Thu, 15 Oct 2009 13:15:16 +0000 Subject: [PATCH] * net/tramp.el (tramp-replace-environment-variables): Do not fail if the environment variable does not exist. --- lisp/net/tramp.el | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index e227de57df4..e7ca0143cc6 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -3922,9 +3922,11 @@ the result will be a local, non-Tramp, filename." "Replace environment variables in FILENAME. Return the string with the replaced variables." (save-match-data - (let ((idx (string-match "$\\w+" filename))) + (let ((idx (string-match "$\\(\\w+\\)" filename))) ;; `$' is coded as `$$'. - (when (and idx (or (zerop idx) (not (eq ?$ (aref filename (1- idx)))))) + (when (and idx + (or (zerop idx) (not (eq ?$ (aref filename (1- idx))))) + (getenv (match-string 1 filename))) (setq filename (replace-match (substitute-in-file-name (match-string 0 filename)) -- 2.39.5