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 | |
| 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.
| -rw-r--r-- | doc/misc/trampver.texi | 2 | ||||
| -rw-r--r-- | lisp/net/tramp.el | 11 | ||||
| -rw-r--r-- | lisp/net/trampver.el | 6 | ||||
| -rw-r--r-- | test/lisp/net/tramp-tests.el | 100 |
4 files changed, 54 insertions, 65 deletions
diff --git a/doc/misc/trampver.texi b/doc/misc/trampver.texi index 8cb0e3d574a..bf5c90ee8a9 100644 --- a/doc/misc/trampver.texi +++ b/doc/misc/trampver.texi | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | 7 | ||
| 8 | @c In the Tramp GIT, the version number and the bug report address | 8 | @c In the Tramp GIT, the version number and the bug report address |
| 9 | @c are auto-frobbed from configure.ac. | 9 | @c are auto-frobbed from configure.ac. |
| 10 | @set trampver 2.7.0 | 10 | @set trampver 2.7.1-pre |
| 11 | @set trampurl https://www.gnu.org/software/tramp/ | 11 | @set trampurl https://www.gnu.org/software/tramp/ |
| 12 | @set tramp-bug-report-address tramp-devel@@gnu.org | 12 | @set tramp-bug-report-address tramp-devel@@gnu.org |
| 13 | @set emacsver 27.1 | 13 | @set emacsver 27.1 |
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index ad36dd53a32..f943bd81a51 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el | |||
| @@ -1205,14 +1205,7 @@ The `ftp' syntax does not support methods.") | |||
| 1205 | ;; FIXME: This shouldn't be necessary. | 1205 | ;; FIXME: This shouldn't be necessary. |
| 1206 | (rx bos "/" (? "[" (* (not "]"))) eos) | 1206 | (rx bos "/" (? "[" (* (not "]"))) eos) |
| 1207 | (rx | 1207 | (rx |
| 1208 | bos | 1208 | (regexp tramp-prefix-regexp) |
| 1209 | ;; `file-name-completion' uses absolute paths for matching. | ||
| 1210 | ;; This means that on W32 systems, something like | ||
| 1211 | ;; "/ssh:host:~/path" becomes "c:/ssh:host:~/path". See also | ||
| 1212 | ;; `tramp-drop-volume-letter'. | ||
| 1213 | (? (regexp tramp-volume-letter-regexp)) | ||
| 1214 | ;; We cannot use `tramp-prefix-regexp', because it starts with `bol'. | ||
| 1215 | (literal tramp-prefix-format) | ||
| 1216 | 1209 | ||
| 1217 | ;; Optional multi-hops. | 1210 | ;; Optional multi-hops. |
| 1218 | (* (regexp tramp-remote-file-name-spec-regexp) | 1211 | (* (regexp tramp-remote-file-name-spec-regexp) |
| @@ -2666,7 +2659,7 @@ not in completion mode." | |||
| 2666 | (string-match-p (rx (regexp tramp-postfix-host-regexp) eos) dir)) | 2659 | (string-match-p (rx (regexp tramp-postfix-host-regexp) eos) dir)) |
| 2667 | (concat dir filename)) | 2660 | (concat dir filename)) |
| 2668 | ((string-match-p | 2661 | ((string-match-p |
| 2669 | (rx bos (regexp tramp-prefix-regexp) | 2662 | (rx (regexp tramp-prefix-regexp) |
| 2670 | (* (regexp tramp-remote-file-name-spec-regexp) | 2663 | (* (regexp tramp-remote-file-name-spec-regexp) |
| 2671 | (regexp tramp-postfix-hop-regexp)) | 2664 | (regexp tramp-postfix-hop-regexp)) |
| 2672 | (? (regexp tramp-method-regexp) (regexp tramp-postfix-method-regexp) | 2665 | (? (regexp tramp-method-regexp) (regexp tramp-postfix-method-regexp) |
diff --git a/lisp/net/trampver.el b/lisp/net/trampver.el index 4b8868561d4..c131d39c110 100644 --- a/lisp/net/trampver.el +++ b/lisp/net/trampver.el | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | ;; Maintainer: Michael Albinus <michael.albinus@gmx.de> | 7 | ;; Maintainer: Michael Albinus <michael.albinus@gmx.de> |
| 8 | ;; Keywords: comm, processes | 8 | ;; Keywords: comm, processes |
| 9 | ;; Package: tramp | 9 | ;; Package: tramp |
| 10 | ;; Version: 2.7.0 | 10 | ;; Version: 2.7.1-pre |
| 11 | ;; Package-Requires: ((emacs "27.1")) | 11 | ;; Package-Requires: ((emacs "27.1")) |
| 12 | ;; Package-Type: multi | 12 | ;; Package-Type: multi |
| 13 | ;; URL: https://www.gnu.org/software/tramp/ | 13 | ;; URL: https://www.gnu.org/software/tramp/ |
| @@ -40,7 +40,7 @@ | |||
| 40 | ;; ./configure" to change them. | 40 | ;; ./configure" to change them. |
| 41 | 41 | ||
| 42 | ;;;###tramp-autoload | 42 | ;;;###tramp-autoload |
| 43 | (defconst tramp-version "2.7.0" | 43 | (defconst tramp-version "2.7.1-pre" |
| 44 | "This version of Tramp.") | 44 | "This version of Tramp.") |
| 45 | 45 | ||
| 46 | ;;;###tramp-autoload | 46 | ;;;###tramp-autoload |
| @@ -78,7 +78,7 @@ | |||
| 78 | ;; Check for Emacs version. | 78 | ;; Check for Emacs version. |
| 79 | (let ((x (if (not (string-version-lessp emacs-version "27.1")) | 79 | (let ((x (if (not (string-version-lessp emacs-version "27.1")) |
| 80 | "ok" | 80 | "ok" |
| 81 | (format "Tramp 2.7.0 is not fit for %s" | 81 | (format "Tramp 2.7.1-pre is not fit for %s" |
| 82 | (replace-regexp-in-string "\n" "" (emacs-version)))))) | 82 | (replace-regexp-in-string "\n" "" (emacs-version)))))) |
| 83 | (unless (string-equal "ok" x) (error "%s" x))) | 83 | (unless (string-equal "ok" x) (error "%s" x))) |
| 84 | 84 | ||
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)) |