]> git.eshelyaron.com Git - emacs.git/commitdiff
* net/tramp.el (tramp-replace-environment-variables): Do not fail
authorMichael Albinus <michael.albinus@gmx.de>
Thu, 15 Oct 2009 13:15:16 +0000 (13:15 +0000)
committerMichael Albinus <michael.albinus@gmx.de>
Thu, 15 Oct 2009 13:15:16 +0000 (13:15 +0000)
if the environment variable does not exist.

lisp/net/tramp.el

index e227de57df459e2112c730cf942a11857fc6199c..e7ca0143cc63c9649eb59023b9de14319931f03a 100644 (file)
@@ -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))