diff options
| author | Michael Albinus | 2024-01-10 12:49:08 +0100 |
|---|---|---|
| committer | Michael Albinus | 2024-01-10 12:49:08 +0100 |
| commit | cf887b7eb08a7ed0859b3fa2e1c4e54d787d2f9d (patch) | |
| tree | 3c668ea6bc9bf5632d3182fb18ef4d66b4b5b518 /test | |
| parent | eb913c7501489e1eae475cae843fccdf14cc24d8 (diff) | |
| download | emacs-cf887b7eb08a7ed0859b3fa2e1c4e54d787d2f9d.tar.gz emacs-cf887b7eb08a7ed0859b3fa2e1c4e54d787d2f9d.zip | |
Fix file name completion with Tramp on MS Windoes
* doc/misc/trampver.texi:
* lisp/net/trampver.el (tramp-version): Adapt Tramp versions.
* lisp/net/tramp.el (tramp-build-completion-file-name-regexp):
Do not use `tramp-volume-letter-regexp'. (Bug#68320)
(tramp-completion-handle-expand-file-name): Simplify regexp.
* test/lisp/net/tramp-tests.el (tramp-test26-file-name-completion)
(tramp-test26-interactive-file-name-completion): Run also on MS Windows.
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/net/tramp-tests.el | 100 |
1 files changed, 48 insertions, 52 deletions
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index 91b0542c759..2a3b3e16891 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el | |||
| @@ -4719,57 +4719,55 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 4719 | "Check `file-name-completion' and `file-name-all-completions'." | 4719 | "Check `file-name-completion' and `file-name-all-completions'." |
| 4720 | (skip-unless (tramp--test-enabled)) | 4720 | (skip-unless (tramp--test-enabled)) |
| 4721 | 4721 | ||
| 4722 | ;; Method and host name in completion mode. This kind of completion | 4722 | ;; Method and host name in completion mode. |
| 4723 | ;; does not work on MS Windows. | 4723 | (let ((tramp-fuse-remove-hidden-files t) |
| 4724 | (unless (memq system-type '(cygwin windows-nt)) | 4724 | (method (file-remote-p ert-remote-temporary-file-directory 'method)) |
| 4725 | (let ((tramp-fuse-remove-hidden-files t) | 4725 | (host (file-remote-p ert-remote-temporary-file-directory 'host)) |
| 4726 | (method (file-remote-p ert-remote-temporary-file-directory 'method)) | 4726 | (orig-syntax tramp-syntax) |
| 4727 | (host (file-remote-p ert-remote-temporary-file-directory 'host)) | 4727 | (minibuffer-completing-file-name t)) |
| 4728 | (orig-syntax tramp-syntax) | 4728 | (when (and (stringp host) (string-match tramp-host-with-port-regexp host)) |
| 4729 | (minibuffer-completing-file-name t)) | 4729 | (setq host (match-string 1 host))) |
| 4730 | (when (and (stringp host) (string-match tramp-host-with-port-regexp host)) | ||
| 4731 | (setq host (match-string 1 host))) | ||
| 4732 | 4730 | ||
| 4733 | (unwind-protect | 4731 | (unwind-protect |
| 4734 | (dolist (syntax (if (tramp--test-expensive-test-p) | 4732 | (dolist (syntax (if (tramp--test-expensive-test-p) |
| 4735 | (tramp-syntax-values) `(,orig-syntax))) | 4733 | (tramp-syntax-values) `(,orig-syntax))) |
| 4736 | (tramp-change-syntax syntax) | 4734 | (tramp-change-syntax syntax) |
| 4737 | ;; This has cleaned up all connection data, which are used | 4735 | ;; This has cleaned up all connection data, which are used |
| 4738 | ;; for completion. We must refill the cache. | 4736 | ;; for completion. We must refill the cache. |
| 4739 | (tramp-set-connection-property tramp-test-vec "property" nil) | 4737 | (tramp-set-connection-property tramp-test-vec "property" nil) |
| 4740 | |||
| 4741 | (let (;; This is needed for the `separate' syntax. | ||
| 4742 | (prefix-format (substring tramp-prefix-format 1)) | ||
| 4743 | ;; This is needed for the IPv6 host name syntax. | ||
| 4744 | (ipv6-prefix | ||
| 4745 | (and (string-match-p tramp-ipv6-regexp host) | ||
| 4746 | tramp-prefix-ipv6-format)) | ||
| 4747 | (ipv6-postfix | ||
| 4748 | (and (string-match-p tramp-ipv6-regexp host) | ||
| 4749 | tramp-postfix-ipv6-format))) | ||
| 4750 | ;; Complete method name. | ||
| 4751 | (unless (or (tramp-string-empty-or-nil-p method) | ||
| 4752 | (string-empty-p tramp-method-regexp)) | ||
| 4753 | (should | ||
| 4754 | (member | ||
| 4755 | (concat prefix-format method tramp-postfix-method-format) | ||
| 4756 | (file-name-all-completions | ||
| 4757 | (concat prefix-format (substring method 0 1)) "/")))) | ||
| 4758 | ;; Complete host name. | ||
| 4759 | (unless (or (tramp-string-empty-or-nil-p method) | ||
| 4760 | (string-empty-p tramp-method-regexp) | ||
| 4761 | (tramp-string-empty-or-nil-p host)) | ||
| 4762 | (should | ||
| 4763 | (member | ||
| 4764 | (concat | ||
| 4765 | prefix-format method tramp-postfix-method-format | ||
| 4766 | ipv6-prefix host ipv6-postfix tramp-postfix-host-format) | ||
| 4767 | (file-name-all-completions | ||
| 4768 | (concat prefix-format method tramp-postfix-method-format) | ||
| 4769 | "/")))))) | ||
| 4770 | 4738 | ||
| 4771 | ;; Cleanup. | 4739 | (let (;; This is needed for the `separate' syntax. |
| 4772 | (tramp-change-syntax orig-syntax)))) | 4740 | (prefix-format (substring tramp-prefix-format 1)) |
| 4741 | ;; This is needed for the IPv6 host name syntax. | ||
| 4742 | (ipv6-prefix | ||
| 4743 | (and (string-match-p tramp-ipv6-regexp host) | ||
| 4744 | tramp-prefix-ipv6-format)) | ||
| 4745 | (ipv6-postfix | ||
| 4746 | (and (string-match-p tramp-ipv6-regexp host) | ||
| 4747 | tramp-postfix-ipv6-format))) | ||
| 4748 | ;; Complete method name. | ||
| 4749 | (unless (or (tramp-string-empty-or-nil-p method) | ||
| 4750 | (string-empty-p tramp-method-regexp)) | ||
| 4751 | (should | ||
| 4752 | (member | ||
| 4753 | (concat prefix-format method tramp-postfix-method-format) | ||
| 4754 | (file-name-all-completions | ||
| 4755 | (concat prefix-format (substring method 0 1)) "/")))) | ||
| 4756 | ;; Complete host name. | ||
| 4757 | (unless (or (tramp-string-empty-or-nil-p method) | ||
| 4758 | (string-empty-p tramp-method-regexp) | ||
| 4759 | (tramp-string-empty-or-nil-p host)) | ||
| 4760 | (should | ||
| 4761 | (member | ||
| 4762 | (concat | ||
| 4763 | prefix-format method tramp-postfix-method-format | ||
| 4764 | ipv6-prefix host ipv6-postfix tramp-postfix-host-format) | ||
| 4765 | (file-name-all-completions | ||
| 4766 | (concat prefix-format method tramp-postfix-method-format) | ||
| 4767 | "/")))))) | ||
| 4768 | |||
| 4769 | ;; Cleanup. | ||
| 4770 | (tramp-change-syntax orig-syntax))) | ||
| 4773 | 4771 | ||
| 4774 | (dolist (non-essential '(nil t)) | 4772 | (dolist (non-essential '(nil t)) |
| 4775 | (dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil))) | 4773 | (dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil))) |
| @@ -4851,9 +4849,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 4851 | ;; and Bug#60505. | 4849 | ;; and Bug#60505. |
| 4852 | (ert-deftest tramp-test26-interactive-file-name-completion () | 4850 | (ert-deftest tramp-test26-interactive-file-name-completion () |
| 4853 | "Check interactive completion with different `completion-styles'." | 4851 | "Check interactive completion with different `completion-styles'." |
| 4854 | ;; Method, user and host name in completion mode. This kind of | 4852 | ;; Method, user and host name in completion mode. |
| 4855 | ;; completion does not work on MS Windows. | ||
| 4856 | (skip-unless (not (memq system-type '(cygwin windows-nt)))) | ||
| 4857 | (tramp-cleanup-connection tramp-test-vec nil 'keep-password) | 4853 | (tramp-cleanup-connection tramp-test-vec nil 'keep-password) |
| 4858 | 4854 | ||
| 4859 | (let ((method (file-remote-p ert-remote-temporary-file-directory 'method)) | 4855 | (let ((method (file-remote-p ert-remote-temporary-file-directory 'method)) |