changeset 80533:a8f8389d5695

* net/tramp.el (tramp-replace-environment-variables): New defun. (tramp-file-name-handler): Use it.
author Michael Albinus <michael.albinus@gmx.de>
date Sun, 27 Apr 2008 09:56:45 +0000
parents 673b1b49aa16
children 3d112d86803d
files lisp/net/tramp.el
diffstat 1 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/net/tramp.el	Sun Apr 27 09:47:14 2008 +0000
+++ b/lisp/net/tramp.el	Sun Apr 27 09:56:45 2008 +0000
@@ -4375,6 +4375,16 @@
 	  (setq res (cdr elt))))
       res)))
 
+(defun tramp-replace-environment-variables (filename)
+  "Replace environment variables in FILENAME.
+Return the string with the replaced variables."
+  (when (string-match "$\\w+" filename)
+    (setq filename
+	  (replace-match
+	   (substitute-in-file-name (match-string 0 filename))
+	   t nil filename)))
+  filename)
+
 ;; Main function.
 ;;;###autoload
 (defun tramp-file-name-handler (operation &rest args)
@@ -4383,7 +4393,9 @@
 ;;  (setq edebug-trace t)
 ;;  (edebug-trace "%s" (with-output-to-string (backtrace)))
   (save-match-data
-    (let* ((filename (apply 'tramp-file-name-for-operation operation args))
+    (let* ((filename
+	    (tramp-replace-environment-variables
+	     (apply 'tramp-file-name-for-operation operation args)))
 	   (completion (tramp-completion-mode-p filename))
 	   (foreign (tramp-find-foreign-file-name-handler filename)))
       (with-parsed-tramp-file-name filename nil