changeset 105615:33df72cf19f1

* net/tramp.el (tramp-replace-environment-variables): Do not fail if the environment variable does not exist.
author Michael Albinus <michael.albinus@gmx.de>
date Thu, 15 Oct 2009 13:15:16 +0000
parents 1823e414dc49
children 13878abadf01
files lisp/net/tramp.el
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/net/tramp.el	Thu Oct 15 10:18:17 2009 +0000
+++ b/lisp/net/tramp.el	Thu Oct 15 13:15:16 2009 +0000
@@ -3922,9 +3922,11 @@
   "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))