diff options
| author | Michael Albinus | 2018-02-05 14:02:49 +0100 |
|---|---|---|
| committer | Michael Albinus | 2018-02-05 14:02:49 +0100 |
| commit | c24c5dc4a4cc18e7f1ec949efcfe1d4bae541d02 (patch) | |
| tree | 094f175c3e001aab5ec37a18a7db0ae3175bf6a9 /lisp | |
| parent | 8fbf28536ee1169f59206523e2af050916befbf6 (diff) | |
| download | emacs-c24c5dc4a4cc18e7f1ec949efcfe1d4bae541d02.tar.gz emacs-c24c5dc4a4cc18e7f1ec949efcfe1d4bae541d02.zip | |
Fix inconsistency expanding "//" in Tramp
* doc/misc/tramp.texi (File name completion): Adapt example
expanding "//".
* lisp/net/tramp.el (tramp-handle-substitute-in-file-name): "//" shall
expand the localname only, even when on top of the local part.
* test/lisp/net/tramp-tests.el (tramp-test04-substitute-in-file-name):
Adapt test.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/net/tramp.el | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 09abd482260..b2e20000d3f 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el | |||
| @@ -3554,17 +3554,19 @@ support symbolic links." | |||
| 3554 | ;; First, we must replace environment variables. | 3554 | ;; First, we must replace environment variables. |
| 3555 | (setq filename (tramp-replace-environment-variables filename)) | 3555 | (setq filename (tramp-replace-environment-variables filename)) |
| 3556 | (with-parsed-tramp-file-name filename nil | 3556 | (with-parsed-tramp-file-name filename nil |
| 3557 | ;; Ignore in LOCALNAME everything before "//" or "/~". | ||
| 3558 | (when (and (stringp localname) (string-match ".+?/\\(/\\|~\\)" localname)) | ||
| 3559 | (setq filename | ||
| 3560 | (concat (file-remote-p filename) | ||
| 3561 | (replace-match "\\1" nil nil localname))) | ||
| 3562 | ;; "/m:h:~" does not work for completion. We use "/m:h:~/". | ||
| 3563 | (when (string-match "~$" filename) | ||
| 3564 | (setq filename (concat filename "/")))) | ||
| 3565 | ;; We do not want to replace environment variables, again. | 3557 | ;; We do not want to replace environment variables, again. |
| 3566 | (let (process-environment) | 3558 | (let (process-environment) |
| 3567 | (tramp-run-real-handler 'substitute-in-file-name (list filename)))))) | 3559 | ;; Ignore in LOCALNAME everything before "//" or "/~". |
| 3560 | (when (stringp localname) | ||
| 3561 | (if (string-match "//\\(/\\|~\\)" localname) | ||
| 3562 | (setq filename (substitute-in-file-name localname)) | ||
| 3563 | (setq filename | ||
| 3564 | (concat (file-remote-p filename) | ||
| 3565 | (substitute-in-file-name localname)))))) | ||
| 3566 | ;; "/m:h:~" does not work for completion. We use "/m:h:~/". | ||
| 3567 | (if (string-match "~$" filename) | ||
| 3568 | (concat filename "/") | ||
| 3569 | filename)))) | ||
| 3568 | 3570 | ||
| 3569 | (defun tramp-handle-set-visited-file-modtime (&optional time-list) | 3571 | (defun tramp-handle-set-visited-file-modtime (&optional time-list) |
| 3570 | "Like `set-visited-file-modtime' for Tramp files." | 3572 | "Like `set-visited-file-modtime' for Tramp files." |