summaryrefslogtreecommitdiff
path: root/lisp/net
diff options
context:
space:
mode:
authorMichael Albinus <michael.albinus@gmx.de>2008-04-27 09:56:45 +0000
committerMichael Albinus <michael.albinus@gmx.de>2008-04-27 09:56:45 +0000
commitbc8dfbbd59cdf03d8df89cf041b4c4943c3664d5 (patch)
treeec034b42b062edb845c6bcb356bda070411b8bec /lisp/net
parent1d375dcb8311394cab75aad9b3a0360008c7e929 (diff)
downloademacs-bc8dfbbd59cdf03d8df89cf041b4c4943c3664d5.tar.gz
emacs-bc8dfbbd59cdf03d8df89cf041b4c4943c3664d5.tar.bz2
emacs-bc8dfbbd59cdf03d8df89cf041b4c4943c3664d5.zip
* net/tramp.el (tramp-replace-environment-variables): New defun.
(tramp-file-name-handler): Use it.
Diffstat (limited to 'lisp/net')
-rw-r--r--lisp/net/tramp.el14
1 files changed, 13 insertions, 1 deletions
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index aaac6bfda88..98eb93aa208 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -4375,6 +4375,16 @@ ARGS are the arguments OPERATION has been called with."
(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 @@ Falls back to normal file name handler if no tramp file name handler exists."
;; (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