aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus2008-04-27 09:56:45 +0000
committerMichael Albinus2008-04-27 09:56:45 +0000
commitbc8dfbbd59cdf03d8df89cf041b4c4943c3664d5 (patch)
treeec034b42b062edb845c6bcb356bda070411b8bec
parent1d375dcb8311394cab75aad9b3a0360008c7e929 (diff)
downloademacs-bc8dfbbd59cdf03d8df89cf041b4c4943c3664d5.tar.gz
emacs-bc8dfbbd59cdf03d8df89cf041b4c4943c3664d5.zip
* net/tramp.el (tramp-replace-environment-variables): New defun.
(tramp-file-name-handler): Use it.
-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."
4375 (setq res (cdr elt)))) 4375 (setq res (cdr elt))))
4376 res))) 4376 res)))
4377 4377
4378(defun tramp-replace-environment-variables (filename)
4379 "Replace environment variables in FILENAME.
4380Return the string with the replaced variables."
4381 (when (string-match "$\\w+" filename)
4382 (setq filename
4383 (replace-match
4384 (substitute-in-file-name (match-string 0 filename))
4385 t nil filename)))
4386 filename)
4387
4378;; Main function. 4388;; Main function.
4379;;;###autoload 4389;;;###autoload
4380(defun tramp-file-name-handler (operation &rest args) 4390(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."
4383;; (setq edebug-trace t) 4393;; (setq edebug-trace t)
4384;; (edebug-trace "%s" (with-output-to-string (backtrace))) 4394;; (edebug-trace "%s" (with-output-to-string (backtrace)))
4385 (save-match-data 4395 (save-match-data
4386 (let* ((filename (apply 'tramp-file-name-for-operation operation args)) 4396 (let* ((filename
4397 (tramp-replace-environment-variables
4398 (apply 'tramp-file-name-for-operation operation args)))
4387 (completion (tramp-completion-mode-p filename)) 4399 (completion (tramp-completion-mode-p filename))
4388 (foreign (tramp-find-foreign-file-name-handler filename))) 4400 (foreign (tramp-find-foreign-file-name-handler filename)))
4389 (with-parsed-tramp-file-name filename nil 4401 (with-parsed-tramp-file-name filename nil