diff options
| author | Michael Albinus | 2017-05-02 16:30:55 +0200 |
|---|---|---|
| committer | Michael Albinus | 2017-05-02 16:30:55 +0200 |
| commit | b50dda3fa2d21973cd87b537a746f5ed70bdc9af (patch) | |
| tree | 3922c514770a62cfe92c29290529f5ada05a49ee | |
| parent | 5f75304f61d6533a8a8dcad1da3b5a223bceaa71 (diff) | |
| download | emacs-b50dda3fa2d21973cd87b537a746f5ed70bdc9af.tar.gz emacs-b50dda3fa2d21973cd87b537a746f5ed70bdc9af.zip | |
Fix error in completion for separate Tramp syntax
* lisp/net/tramp.el (tramp-completion-file-name-regexp-separate):
Tweak regexp.
* test/lisp/net/tramp-tests.el (tramp-test24-file-name-completion):
Run method and host name completion for all syntaxes.
| -rw-r--r-- | lisp/net/tramp.el | 2 | ||||
| -rw-r--r-- | test/lisp/net/tramp-tests.el | 79 |
2 files changed, 55 insertions, 26 deletions
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 56a7b377124..33e5900f3c2 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el | |||
| @@ -945,7 +945,7 @@ See `tramp-file-name-structure' for more explanations. | |||
| 945 | On W32 systems, the volume letter must be ignored.") | 945 | On W32 systems, the volume letter must be ignored.") |
| 946 | 946 | ||
| 947 | (defconst tramp-completion-file-name-regexp-separate | 947 | (defconst tramp-completion-file-name-regexp-separate |
| 948 | "\\`/\\[[^]]*\\'" | 948 | "\\`/\\(\\[[^]]*\\)?\\'" |
| 949 | "Value for `tramp-completion-file-name-regexp' for separate remoting. | 949 | "Value for `tramp-completion-file-name-regexp' for separate remoting. |
| 950 | See `tramp-file-name-structure' for more explanations.") | 950 | See `tramp-file-name-structure' for more explanations.") |
| 951 | 951 | ||
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index 1d487bc12d7..8db54979b6d 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el | |||
| @@ -2448,37 +2448,66 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 2448 | "Check `file-name-completion' and `file-name-all-completions'." | 2448 | "Check `file-name-completion' and `file-name-all-completions'." |
| 2449 | (skip-unless (tramp--test-enabled)) | 2449 | (skip-unless (tramp--test-enabled)) |
| 2450 | 2450 | ||
| 2451 | ;; Method and host name in completion mode. This kind of completion | ||
| 2452 | ;; does not work on MS Windows. | ||
| 2453 | (when (not (memq system-type '(cygwin windows-nt))) | ||
| 2454 | (let ((method (file-remote-p tramp-test-temporary-file-directory 'method)) | ||
| 2455 | (host (file-remote-p tramp-test-temporary-file-directory 'host)) | ||
| 2456 | (orig-syntax tramp-syntax)) | ||
| 2457 | |||
| 2458 | (unwind-protect | ||
| 2459 | (dolist (syntax (tramp-syntax-values)) | ||
| 2460 | (tramp-change-syntax syntax) | ||
| 2461 | (let ;; This is needed for the `simplified' syntax. | ||
| 2462 | ((method-marker | ||
| 2463 | (if (zerop (length (tramp-method-regexp))) | ||
| 2464 | "" tramp-default-method-marker)) | ||
| 2465 | ;; This is needed for the `separate' syntax. | ||
| 2466 | (prefix-format (substring (tramp-prefix-format) 1))) | ||
| 2467 | ;; Complete method name. | ||
| 2468 | (unless (or (zerop (length method)) | ||
| 2469 | (zerop (length (tramp-method-regexp)))) | ||
| 2470 | (should | ||
| 2471 | (member | ||
| 2472 | (concat prefix-format method (tramp-postfix-method-format)) | ||
| 2473 | (file-name-all-completions | ||
| 2474 | (concat prefix-format (substring method 0 1)) "/")))) | ||
| 2475 | ;; Complete host name for default method. | ||
| 2476 | (unless (zerop (length host)) | ||
| 2477 | (let ((tramp-default-method (or method tramp-default-method))) | ||
| 2478 | (should | ||
| 2479 | (member | ||
| 2480 | (concat | ||
| 2481 | prefix-format method-marker (tramp-postfix-method-format) | ||
| 2482 | host (tramp-postfix-host-format)) | ||
| 2483 | (file-name-all-completions | ||
| 2484 | (concat | ||
| 2485 | prefix-format method-marker (tramp-postfix-method-format) | ||
| 2486 | (substring host 0 1)) | ||
| 2487 | "/"))))) | ||
| 2488 | ;; Complete host name. | ||
| 2489 | (unless (or (zerop (length method)) | ||
| 2490 | (zerop (length (tramp-method-regexp))) | ||
| 2491 | (zerop (length host))) | ||
| 2492 | (should | ||
| 2493 | (member | ||
| 2494 | (concat | ||
| 2495 | prefix-format method (tramp-postfix-method-format) | ||
| 2496 | host (tramp-postfix-host-format)) | ||
| 2497 | (file-name-all-completions | ||
| 2498 | (concat prefix-format method (tramp-postfix-method-format)) | ||
| 2499 | "/")))))) | ||
| 2500 | |||
| 2501 | ;; Cleanup. | ||
| 2502 | (tramp-change-syntax orig-syntax)))) | ||
| 2503 | |||
| 2451 | (dolist (n-e '(nil t)) | 2504 | (dolist (n-e '(nil t)) |
| 2452 | (dolist (quoted (if tramp--test-expensive-test '(nil t) '(nil))) | 2505 | (dolist (quoted (if tramp--test-expensive-test '(nil t) '(nil))) |
| 2453 | (let ((non-essential n-e) | 2506 | (let ((non-essential n-e) |
| 2454 | (tmp-name (tramp--test-make-temp-name nil quoted)) | 2507 | (tmp-name (tramp--test-make-temp-name nil quoted))) |
| 2455 | (method (file-remote-p tramp-test-temporary-file-directory 'method)) | ||
| 2456 | (host (file-remote-p tramp-test-temporary-file-directory 'host))) | ||
| 2457 | 2508 | ||
| 2458 | (unwind-protect | 2509 | (unwind-protect |
| 2459 | (progn | 2510 | (progn |
| 2460 | ;; Method and host name in completion mode. This kind | ||
| 2461 | ;; of completion does not work on MS Windows. | ||
| 2462 | (when (not (memq system-type '(cygwin windows-nt))) | ||
| 2463 | (unless (zerop (length method)) | ||
| 2464 | (should | ||
| 2465 | (member | ||
| 2466 | (format "%s:" method) | ||
| 2467 | (file-name-all-completions (substring method 0 1) "/")))) | ||
| 2468 | (unless (zerop (length host)) | ||
| 2469 | (let ((tramp-default-method (or method tramp-default-method))) | ||
| 2470 | (should | ||
| 2471 | (member | ||
| 2472 | (format "-:%s:" host) | ||
| 2473 | (file-name-all-completions | ||
| 2474 | (format "-:%s" (substring host 0 1)) "/"))))) | ||
| 2475 | (unless (or (zerop (length method)) (zerop (length host))) | ||
| 2476 | (should | ||
| 2477 | (member | ||
| 2478 | (format "%s:%s:" method host) | ||
| 2479 | (file-name-all-completions | ||
| 2480 | (format "%s:" method) "/"))))) | ||
| 2481 | |||
| 2482 | ;; Local files. | 2511 | ;; Local files. |
| 2483 | (make-directory tmp-name) | 2512 | (make-directory tmp-name) |
| 2484 | (should (file-directory-p tmp-name)) | 2513 | (should (file-directory-p tmp-name)) |