diff options
| author | Michael Albinus | 2017-09-11 17:12:32 +0200 |
|---|---|---|
| committer | Michael Albinus | 2017-09-11 17:12:32 +0200 |
| commit | 7004545244ea5efbe7a37db72431f982c70576e6 (patch) | |
| tree | ce64bd36195091d72a4a2ef86eb80d624be4fcc5 | |
| parent | 29963648dd11d53088f753e4f9b0491a7b981c0f (diff) | |
| download | emacs-7004545244ea5efbe7a37db72431f982c70576e6.tar.gz emacs-7004545244ea5efbe7a37db72431f982c70576e6.zip | |
Further optimization in Tramp's file name decomposition
* lisp/net/tramp.el (tramp-syntax): Recompute all file name
components. Call `custom-set-variables' after loading.
(tramp-build-prefix-format, tramp-build-prefix-regexp)
(tramp-build-method-regexp)
(tramp-build-postfix-method-format)
(tramp-build-postfix-method-regexp)
(tramp-build-prefix-ipv6-format)
(tramp-build-prefix-ipv6-regexp)
(tramp-build-postfix-ipv6-format)
(tramp-build-postfix-ipv6-regexp)
(tramp-build-postfix-host-format)
(tramp-build-postfix-host-regexp)
(tramp-build-file-name-regexp)
(tramp-build-completion-file-name-regexp): New defuns.
(tramp-prefix-format, tramp-prefix-regexp)
(tramp-method-regexp, tramp-postfix-method-format)
(tramp-postfix-method-regexp, tramp-prefix-ipv6-format)
(tramp-prefix-ipv6-regexp, tramp-postfix-ipv6-format)
(tramp-postfix-ipv6-regexp, tramp-postfix-host-format)
(tramp-postfix-host-regexp)
(tramp-remote-file-name-spec-regexp)
(tramp-file-name-structure, tramp-file-name-regexp)
(tramp-completion-file-name-regexp): Convert defuns into defvars.
(tramp-prefix-regexp-alist)
(tramp-postfix-method-regexp-alist)
(tramp-prefix-ipv6-regexp-alist)
(tramp-postfix-ipv6-regexp-alist)
(tramp-postfix-host-regexp-alist)
(tramp-remote-file-name-spec-regexp-alist): Remove.
(tramp-build-remote-file-name-spec-regexp)
(tramp-build-file-name-structure): Simplify.
(tramp-completion-file-name-regexp-alist): New defconst.
(tramp-tramp-file-p, tramp-dissect-file-name)
(tramp-make-tramp-file-name)
(tramp-completion-make-tramp-file-name)
(tramp-rfn-eshadow-update-overlay-regexp)
(tramp-register-file-name-handlers)
(tramp-completion-handle-file-name-all-completions)
(tramp-completion-dissect-file-name, tramp-clear-passwd):
* lisp/net/tramp-ftp.el (tramp-ftp-file-name-handler):
* lisp/net/tramp-sh.el (tramp-sh-handle-vc-registered)
(tramp-compute-multi-hops): Use variables but functions for
file name components.
* test/lisp/net/tramp-tests.el (tramp-test24-file-name-completion):
Use variables but functions for file name components.
| -rw-r--r-- | lisp/net/tramp-ftp.el | 8 | ||||
| -rw-r--r-- | lisp/net/tramp-sh.el | 4 | ||||
| -rw-r--r-- | lisp/net/tramp.el | 366 | ||||
| -rw-r--r-- | test/lisp/net/tramp-tests.el | 22 |
4 files changed, 195 insertions, 205 deletions
diff --git a/lisp/net/tramp-ftp.el b/lisp/net/tramp-ftp.el index 8e489eee801..85afd52bf42 100644 --- a/lisp/net/tramp-ftp.el +++ b/lisp/net/tramp-ftp.el | |||
| @@ -121,10 +121,10 @@ pass to the OPERATION." | |||
| 121 | (or (boundp 'ange-ftp-name-format) | 121 | (or (boundp 'ange-ftp-name-format) |
| 122 | (let (file-name-handler-alist) (require 'ange-ftp))) | 122 | (let (file-name-handler-alist) (require 'ange-ftp))) |
| 123 | (let ((ange-ftp-name-format | 123 | (let ((ange-ftp-name-format |
| 124 | (list (nth 0 (tramp-file-name-structure)) | 124 | (list (nth 0 tramp-file-name-structure) |
| 125 | (nth 3 (tramp-file-name-structure)) | 125 | (nth 3 tramp-file-name-structure) |
| 126 | (nth 2 (tramp-file-name-structure)) | 126 | (nth 2 tramp-file-name-structure) |
| 127 | (nth 4 (tramp-file-name-structure)))) | 127 | (nth 4 tramp-file-name-structure))) |
| 128 | ;; ange-ftp uses `ange-ftp-ftp-name-arg' and `ange-ftp-ftp-name-res' | 128 | ;; ange-ftp uses `ange-ftp-ftp-name-arg' and `ange-ftp-ftp-name-res' |
| 129 | ;; for optimization in `ange-ftp-ftp-name'. If Tramp wasn't active, | 129 | ;; for optimization in `ange-ftp-ftp-name'. If Tramp wasn't active, |
| 130 | ;; there could be incorrect values from previous calls in case the | 130 | ;; there could be incorrect values from previous calls in case the |
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 597ca6a6202..01fe335963b 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el | |||
| @@ -3437,7 +3437,7 @@ the result will be a local, non-Tramp, file name." | |||
| 3437 | (let (tramp-vc-registered-file-names | 3437 | (let (tramp-vc-registered-file-names |
| 3438 | (remote-file-name-inhibit-cache (current-time)) | 3438 | (remote-file-name-inhibit-cache (current-time)) |
| 3439 | (file-name-handler-alist | 3439 | (file-name-handler-alist |
| 3440 | `((,(tramp-file-name-regexp) . tramp-vc-file-name-handler)))) | 3440 | `((,tramp-file-name-regexp . tramp-vc-file-name-handler)))) |
| 3441 | 3441 | ||
| 3442 | ;; Here we collect only file names, which need an operation. | 3442 | ;; Here we collect only file names, which need an operation. |
| 3443 | (tramp-with-demoted-errors | 3443 | (tramp-with-demoted-errors |
| @@ -4468,7 +4468,7 @@ Goes through the list `tramp-inline-compress-commands'." | |||
| 4468 | (let ((user (tramp-file-name-user item)) | 4468 | (let ((user (tramp-file-name-user item)) |
| 4469 | (host (tramp-file-name-host item)) | 4469 | (host (tramp-file-name-host item)) |
| 4470 | (proxy (concat | 4470 | (proxy (concat |
| 4471 | (tramp-prefix-format) proxy (tramp-postfix-host-format)))) | 4471 | tramp-prefix-format proxy tramp-postfix-host-format))) |
| 4472 | (tramp-message | 4472 | (tramp-message |
| 4473 | vec 5 "Add proxy (\"%s\" \"%s\" \"%s\")" | 4473 | vec 5 "Add proxy (\"%s\" \"%s\" \"%s\")" |
| 4474 | (and (stringp host) (regexp-quote host)) | 4474 | (and (stringp host) (regexp-quote host)) |
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 118960be5ed..14624593e0c 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el | |||
| @@ -689,11 +689,34 @@ Do not change the value by `setq', it must be changed only by | |||
| 689 | (tramp-cleanup-all-buffers)) | 689 | (tramp-cleanup-all-buffers)) |
| 690 | ;; Set the value: | 690 | ;; Set the value: |
| 691 | (set-default symbol value) | 691 | (set-default symbol value) |
| 692 | ;; Reset `tramp-file-name-regexp'. | 692 | ;; Reset the depending variables. |
| 693 | (setq tramp-file-name-regexp (tramp-file-name-regexp)) | 693 | (with-no-warnings |
| 694 | (setq tramp-prefix-format (tramp-build-prefix-format) | ||
| 695 | tramp-prefix-regexp (tramp-build-prefix-regexp) | ||
| 696 | tramp-method-regexp (tramp-build-method-regexp) | ||
| 697 | tramp-postfix-method-format (tramp-build-postfix-method-format) | ||
| 698 | tramp-postfix-method-regexp (tramp-build-postfix-method-regexp) | ||
| 699 | tramp-prefix-ipv6-format (tramp-build-prefix-ipv6-format) | ||
| 700 | tramp-prefix-ipv6-regexp (tramp-build-prefix-ipv6-regexp) | ||
| 701 | tramp-postfix-ipv6-format (tramp-build-postfix-ipv6-format) | ||
| 702 | tramp-postfix-ipv6-regexp (tramp-build-postfix-ipv6-regexp) | ||
| 703 | tramp-postfix-host-format (tramp-build-postfix-host-format) | ||
| 704 | tramp-postfix-host-regexp (tramp-build-postfix-host-regexp) | ||
| 705 | tramp-remote-file-name-spec-regexp | ||
| 706 | (tramp-build-remote-file-name-spec-regexp) | ||
| 707 | tramp-file-name-structure (tramp-build-file-name-structure) | ||
| 708 | tramp-file-name-regexp (tramp-build-file-name-regexp) | ||
| 709 | tramp-completion-file-name-regexp | ||
| 710 | (tramp-build-completion-file-name-regexp))) | ||
| 694 | ;; Rearrange file name handlers. | 711 | ;; Rearrange file name handlers. |
| 695 | (tramp-register-file-name-handlers))) | 712 | (tramp-register-file-name-handlers))) |
| 696 | 713 | ||
| 714 | ;; Initialize the Tramp syntax variables. We want to override initial | ||
| 715 | ;; values of `tramp-file-name-regexp' and | ||
| 716 | ;; `tramp-completion-file-name-regexp'. | ||
| 717 | (eval-after-load 'tramp | ||
| 718 | '(custom-set-variables `(tramp-syntax ',(tramp-compat-tramp-syntax)))) | ||
| 719 | |||
| 697 | (defun tramp-syntax-values () | 720 | (defun tramp-syntax-values () |
| 698 | "Return possible values of `tramp-syntax', a list" | 721 | "Return possible values of `tramp-syntax', a list" |
| 699 | (let ((values (cdr (get 'tramp-syntax 'custom-type)))) | 722 | (let ((values (cdr (get 'tramp-syntax 'custom-type)))) |
| @@ -712,22 +735,19 @@ Raise an error if `tramp-syntax' is invalid." | |||
| 712 | (separate . "/[")) | 735 | (separate . "/[")) |
| 713 | "Alist mapping Tramp syntax to strings beginning Tramp file names.") | 736 | "Alist mapping Tramp syntax to strings beginning Tramp file names.") |
| 714 | 737 | ||
| 715 | (defun tramp-prefix-format () | 738 | (defun tramp-build-prefix-format () |
| 716 | "String matching the very beginning of Tramp file names. | ||
| 717 | Used in `tramp-make-tramp-file-name'." | ||
| 718 | (tramp-lookup-syntax tramp-prefix-format-alist)) | 739 | (tramp-lookup-syntax tramp-prefix-format-alist)) |
| 719 | 740 | ||
| 720 | (defconst tramp-prefix-regexp-alist | 741 | (defvar tramp-prefix-format (tramp-build-prefix-format) |
| 721 | (mapcar (lambda (x) | 742 | "String matching the very beginning of Tramp file names. |
| 722 | (cons (car x) (concat "^" (regexp-quote (cdr x))))) | 743 | Used in `tramp-make-tramp-file-name'.") |
| 723 | tramp-prefix-format-alist) | 744 | |
| 724 | "Alist of regexps matching the beginnings of Tramp file names. | 745 | (defun tramp-build-prefix-regexp () |
| 725 | Keyed by Tramp syntax. Derived from `tramp-prefix-format-alist'.") | 746 | (concat "^" (regexp-quote tramp-prefix-format))) |
| 726 | 747 | ||
| 727 | (defun tramp-prefix-regexp () | 748 | (defvar tramp-prefix-regexp (tramp-build-prefix-regexp) |
| 728 | "Regexp matching the very beginning of Tramp file names. | 749 | "Regexp matching the very beginning of Tramp file names. |
| 729 | Should always start with \"^\". Derived from `tramp-prefix-format'." | 750 | Should always start with \"^\". Derived from `tramp-prefix-format'.") |
| 730 | (tramp-lookup-syntax tramp-prefix-regexp-alist)) | ||
| 731 | 751 | ||
| 732 | (defconst tramp-method-regexp-alist | 752 | (defconst tramp-method-regexp-alist |
| 733 | '((default . "[a-zA-Z0-9-]+") | 753 | '((default . "[a-zA-Z0-9-]+") |
| @@ -735,34 +755,33 @@ Should always start with \"^\". Derived from `tramp-prefix-format'." | |||
| 735 | (separate . "[a-zA-Z0-9-]*")) | 755 | (separate . "[a-zA-Z0-9-]*")) |
| 736 | "Alist mapping Tramp syntax to regexps matching methods identifiers.") | 756 | "Alist mapping Tramp syntax to regexps matching methods identifiers.") |
| 737 | 757 | ||
| 738 | (defun tramp-method-regexp () | 758 | (defun tramp-build-method-regexp () |
| 739 | "Regexp matching methods identifiers. | ||
| 740 | The `ftp' syntax does not support methods." | ||
| 741 | (tramp-lookup-syntax tramp-method-regexp-alist)) | 759 | (tramp-lookup-syntax tramp-method-regexp-alist)) |
| 742 | 760 | ||
| 761 | (defvar tramp-method-regexp (tramp-build-method-regexp) | ||
| 762 | "Regexp matching methods identifiers. | ||
| 763 | The `ftp' syntax does not support methods.") | ||
| 764 | |||
| 743 | (defconst tramp-postfix-method-format-alist | 765 | (defconst tramp-postfix-method-format-alist |
| 744 | '((default . ":") | 766 | '((default . ":") |
| 745 | (simplified . "") | 767 | (simplified . "") |
| 746 | (separate . "/")) | 768 | (separate . "/")) |
| 747 | "Alist mapping Tramp syntax to the delimiter after the method.") | 769 | "Alist mapping Tramp syntax to the delimiter after the method.") |
| 748 | 770 | ||
| 749 | (defun tramp-postfix-method-format () | 771 | (defun tramp-build-postfix-method-format () |
| 772 | (tramp-lookup-syntax tramp-postfix-method-format-alist)) | ||
| 773 | |||
| 774 | (defvar tramp-postfix-method-format (tramp-build-postfix-method-format) | ||
| 750 | "String matching delimiter between method and user or host names. | 775 | "String matching delimiter between method and user or host names. |
| 751 | The `ftp' syntax does not support methods. | 776 | The `ftp' syntax does not support methods. |
| 752 | Used in `tramp-make-tramp-file-name'." | 777 | Used in `tramp-make-tramp-file-name'.") |
| 753 | (tramp-lookup-syntax tramp-postfix-method-format-alist)) | ||
| 754 | 778 | ||
| 755 | (defconst tramp-postfix-method-regexp-alist | 779 | (defun tramp-build-postfix-method-regexp () |
| 756 | (mapcar (lambda (x) | 780 | (regexp-quote tramp-postfix-method-format)) |
| 757 | (cons (car x) (regexp-quote (cdr x)))) | ||
| 758 | tramp-postfix-method-format-alist) | ||
| 759 | "Alist mapping Tramp syntax to regexp matching delimiter after method. | ||
| 760 | Derived from `tramp-postfix-method-format-alist'.") | ||
| 761 | 781 | ||
| 762 | (defun tramp-postfix-method-regexp () | 782 | (defvar tramp-postfix-method-regexp (tramp-build-postfix-method-regexp) |
| 763 | "Regexp matching delimiter between method and user or host names. | 783 | "Regexp matching delimiter between method and user or host names. |
| 764 | Derived from `tramp-postfix-method-format'." | 784 | Derived from `tramp-postfix-method-format'.") |
| 765 | (tramp-lookup-syntax tramp-postfix-method-regexp-alist)) | ||
| 766 | 785 | ||
| 767 | (defconst tramp-user-regexp "[^/|: \t]+" | 786 | (defconst tramp-user-regexp "[^/|: \t]+" |
| 768 | "Regexp matching user names.") | 787 | "Regexp matching user names.") |
| @@ -772,8 +791,7 @@ Derived from `tramp-postfix-method-format'." | |||
| 772 | "String matching delimiter between user and domain names.") | 791 | "String matching delimiter between user and domain names.") |
| 773 | 792 | ||
| 774 | ;;;###tramp-autoload | 793 | ;;;###tramp-autoload |
| 775 | (defconst tramp-prefix-domain-regexp | 794 | (defconst tramp-prefix-domain-regexp (regexp-quote tramp-prefix-domain-format) |
| 776 | (regexp-quote tramp-prefix-domain-format) | ||
| 777 | "Regexp matching delimiter between user and domain names. | 795 | "Regexp matching delimiter between user and domain names. |
| 778 | Derived from `tramp-prefix-domain-format'.") | 796 | Derived from `tramp-prefix-domain-format'.") |
| 779 | 797 | ||
| @@ -790,8 +808,7 @@ Derived from `tramp-prefix-domain-format'.") | |||
| 790 | "String matching delimiter between user and host names. | 808 | "String matching delimiter between user and host names. |
| 791 | Used in `tramp-make-tramp-file-name'.") | 809 | Used in `tramp-make-tramp-file-name'.") |
| 792 | 810 | ||
| 793 | (defconst tramp-postfix-user-regexp | 811 | (defconst tramp-postfix-user-regexp (regexp-quote tramp-postfix-user-format) |
| 794 | (regexp-quote tramp-postfix-user-format) | ||
| 795 | "Regexp matching delimiter between user and host names. | 812 | "Regexp matching delimiter between user and host names. |
| 796 | Derived from `tramp-postfix-user-format'.") | 813 | Derived from `tramp-postfix-user-format'.") |
| 797 | 814 | ||
| @@ -804,28 +821,24 @@ Derived from `tramp-postfix-user-format'.") | |||
| 804 | (separate . "")) | 821 | (separate . "")) |
| 805 | "Alist mapping Tramp syntax to strings prefixing IPv6 addresses.") | 822 | "Alist mapping Tramp syntax to strings prefixing IPv6 addresses.") |
| 806 | 823 | ||
| 807 | (defun tramp-prefix-ipv6-format () | 824 | (defun tramp-build-prefix-ipv6-format () |
| 808 | "String matching left hand side of IPv6 addresses. | ||
| 809 | Used in `tramp-make-tramp-file-name'." | ||
| 810 | (tramp-lookup-syntax tramp-prefix-ipv6-format-alist)) | 825 | (tramp-lookup-syntax tramp-prefix-ipv6-format-alist)) |
| 811 | 826 | ||
| 812 | (defconst tramp-prefix-ipv6-regexp-alist | 827 | (defvar tramp-prefix-ipv6-format (tramp-build-prefix-ipv6-format) |
| 813 | (mapcar (lambda (x) | 828 | "String matching left hand side of IPv6 addresses. |
| 814 | (cons (car x) (regexp-quote (cdr x)))) | 829 | Used in `tramp-make-tramp-file-name'.") |
| 815 | tramp-prefix-ipv6-format-alist) | 830 | |
| 816 | "Alist mapping Tramp syntax to regexp matching prefix of IPv6 addresses. | 831 | (defun tramp-build-prefix-ipv6-regexp () |
| 817 | Derived from `tramp-prefix-ipv6-format-alist'") | 832 | (regexp-quote tramp-prefix-ipv6-format)) |
| 818 | 833 | ||
| 819 | (defun tramp-prefix-ipv6-regexp () | 834 | (defvar tramp-prefix-ipv6-regexp (tramp-build-prefix-ipv6-regexp) |
| 820 | "Regexp matching left hand side of IPv6 addresses. | 835 | "Regexp matching left hand side of IPv6 addresses. |
| 821 | Derived from `tramp-prefix-ipv6-format'." | 836 | Derived from `tramp-prefix-ipv6-format'.") |
| 822 | (tramp-lookup-syntax tramp-prefix-ipv6-regexp-alist)) | ||
| 823 | 837 | ||
| 824 | ;; The following regexp is a bit sloppy. But it shall serve our | 838 | ;; The following regexp is a bit sloppy. But it shall serve our |
| 825 | ;; purposes. It covers also IPv4 mapped IPv6 addresses, like in | 839 | ;; purposes. It covers also IPv4 mapped IPv6 addresses, like in |
| 826 | ;; "::ffff:192.168.0.1". | 840 | ;; "::ffff:192.168.0.1". |
| 827 | (defconst tramp-ipv6-regexp | 841 | (defconst tramp-ipv6-regexp "\\(?:\\(?:[a-zA-Z0-9]+\\)?:\\)+[a-zA-Z0-9.]+" |
| 828 | "\\(?:\\(?:[a-zA-Z0-9]+\\)?:\\)+[a-zA-Z0-9.]+" | ||
| 829 | "Regexp matching IPv6 addresses.") | 842 | "Regexp matching IPv6 addresses.") |
| 830 | 843 | ||
| 831 | (defconst tramp-postfix-ipv6-format-alist | 844 | (defconst tramp-postfix-ipv6-format-alist |
| @@ -834,28 +847,24 @@ Derived from `tramp-prefix-ipv6-format'." | |||
| 834 | (separate . "")) | 847 | (separate . "")) |
| 835 | "Alist mapping Tramp syntax to suffix for IPv6 addresses.") | 848 | "Alist mapping Tramp syntax to suffix for IPv6 addresses.") |
| 836 | 849 | ||
| 837 | (defun tramp-postfix-ipv6-format () | 850 | (defun tramp-build-postfix-ipv6-format () |
| 838 | "String matching right hand side of IPv6 addresses. | ||
| 839 | Used in `tramp-make-tramp-file-name'." | ||
| 840 | (tramp-lookup-syntax tramp-postfix-ipv6-format-alist)) | 851 | (tramp-lookup-syntax tramp-postfix-ipv6-format-alist)) |
| 841 | 852 | ||
| 842 | (defconst tramp-postfix-ipv6-regexp-alist | 853 | (defvar tramp-postfix-ipv6-format (tramp-build-postfix-ipv6-format) |
| 843 | (mapcar (lambda (x) | 854 | "String matching right hand side of IPv6 addresses. |
| 844 | (cons (car x) (regexp-quote (cdr x)))) | 855 | Used in `tramp-make-tramp-file-name'.") |
| 845 | tramp-postfix-ipv6-format-alist) | 856 | |
| 846 | "Alist mapping Tramp syntax to regexps matching IPv6 suffixes. | 857 | (defun tramp-build-postfix-ipv6-regexp () |
| 847 | Derived from `tramp-postfix-ipv6-format-alist'.") | 858 | (regexp-quote tramp-postfix-ipv6-format)) |
| 848 | 859 | ||
| 849 | (defun tramp-postfix-ipv6-regexp () | 860 | (defvar tramp-postfix-ipv6-regexp (tramp-build-postfix-ipv6-regexp) |
| 850 | "Regexp matching right hand side of IPv6 addresses. | 861 | "Regexp matching right hand side of IPv6 addresses. |
| 851 | Derived from `tramp-postfix-ipv6-format'." | 862 | Derived from `tramp-postfix-ipv6-format'.") |
| 852 | (tramp-lookup-syntax tramp-postfix-ipv6-format-alist)) | ||
| 853 | 863 | ||
| 854 | (defconst tramp-prefix-port-format "#" | 864 | (defconst tramp-prefix-port-format "#" |
| 855 | "String matching delimiter between host names and port numbers.") | 865 | "String matching delimiter between host names and port numbers.") |
| 856 | 866 | ||
| 857 | (defconst tramp-prefix-port-regexp | 867 | (defconst tramp-prefix-port-regexp (regexp-quote tramp-prefix-port-format) |
| 858 | (regexp-quote tramp-prefix-port-format) | ||
| 859 | "Regexp matching delimiter between host names and port numbers. | 868 | "Regexp matching delimiter between host names and port numbers. |
| 860 | Derived from `tramp-prefix-port-format'.") | 869 | Derived from `tramp-prefix-port-format'.") |
| 861 | 870 | ||
| @@ -871,8 +880,7 @@ Derived from `tramp-prefix-port-format'.") | |||
| 871 | (defconst tramp-postfix-hop-format "|" | 880 | (defconst tramp-postfix-hop-format "|" |
| 872 | "String matching delimiter after ad-hoc hop definitions.") | 881 | "String matching delimiter after ad-hoc hop definitions.") |
| 873 | 882 | ||
| 874 | (defconst tramp-postfix-hop-regexp | 883 | (defconst tramp-postfix-hop-regexp (regexp-quote tramp-postfix-hop-format) |
| 875 | (regexp-quote tramp-postfix-hop-format) | ||
| 876 | "Regexp matching delimiter after ad-hoc hop definitions. | 884 | "Regexp matching delimiter after ad-hoc hop definitions. |
| 877 | Derived from `tramp-postfix-hop-format'.") | 885 | Derived from `tramp-postfix-hop-format'.") |
| 878 | 886 | ||
| @@ -882,22 +890,19 @@ Derived from `tramp-postfix-hop-format'.") | |||
| 882 | (separate . "]")) | 890 | (separate . "]")) |
| 883 | "Alist mapping Tramp syntax to strings between host and local names.") | 891 | "Alist mapping Tramp syntax to strings between host and local names.") |
| 884 | 892 | ||
| 885 | (defun tramp-postfix-host-format () | 893 | (defun tramp-build-postfix-host-format () |
| 886 | "String matching delimiter between host names and localnames. | ||
| 887 | Used in `tramp-make-tramp-file-name'." | ||
| 888 | (tramp-lookup-syntax tramp-postfix-host-format-alist)) | 894 | (tramp-lookup-syntax tramp-postfix-host-format-alist)) |
| 889 | 895 | ||
| 890 | (defconst tramp-postfix-host-regexp-alist | 896 | (defvar tramp-postfix-host-format (tramp-build-postfix-host-format) |
| 891 | (mapcar (lambda (x) | 897 | "String matching delimiter between host names and localnames. |
| 892 | (cons (car x) (regexp-quote (cdr x)))) | 898 | Used in `tramp-make-tramp-file-name'.") |
| 893 | tramp-postfix-host-format-alist) | ||
| 894 | "Alist mapping Tramp syntax to regexp matching name delimiters. | ||
| 895 | Derived from `tramp-postfix-host-format-alist'.") | ||
| 896 | 899 | ||
| 897 | (defun tramp-postfix-host-regexp () | 900 | (defun tramp-build-postfix-host-regexp () |
| 901 | (regexp-quote tramp-postfix-host-format)) | ||
| 902 | |||
| 903 | (defvar tramp-postfix-host-regexp (tramp-build-postfix-host-regexp) | ||
| 898 | "Regexp matching delimiter between host names and localnames. | 904 | "Regexp matching delimiter between host names and localnames. |
| 899 | Derived from `tramp-postfix-host-format'." | 905 | Derived from `tramp-postfix-host-format'.") |
| 900 | (tramp-lookup-syntax tramp-postfix-host-regexp-alist)) | ||
| 901 | 906 | ||
| 902 | (defconst tramp-localname-regexp ".*$" | 907 | (defconst tramp-localname-regexp ".*$" |
| 903 | "Regexp matching localnames.") | 908 | "Regexp matching localnames.") |
| @@ -910,48 +915,35 @@ Derived from `tramp-postfix-host-format'." | |||
| 910 | 915 | ||
| 911 | ;;; File name format: | 916 | ;;; File name format: |
| 912 | 917 | ||
| 913 | (defun tramp-build-remote-file-name-spec-regexp (syntax) | 918 | (defun tramp-build-remote-file-name-spec-regexp () |
| 914 | "Construct a regexp matching a Tramp file name for a Tramp SYNTAX." | 919 | "Construct a regexp matching a Tramp file name for a Tramp syntax. |
| 915 | (let ((tramp-syntax syntax)) | 920 | It is expected, that `tramp-syntax' has the proper value." |
| 916 | (concat | 921 | (concat |
| 917 | "\\(" (tramp-method-regexp) "\\)" (tramp-postfix-method-regexp) | 922 | "\\(" tramp-method-regexp "\\)" tramp-postfix-method-regexp |
| 918 | "\\(?:" "\\(" tramp-user-regexp "\\)" tramp-postfix-user-regexp "\\)?" | 923 | "\\(?:" "\\(" tramp-user-regexp "\\)" tramp-postfix-user-regexp "\\)?" |
| 919 | "\\(" "\\(?:" tramp-host-regexp "\\|" | 924 | "\\(" "\\(?:" tramp-host-regexp "\\|" |
| 920 | (tramp-prefix-ipv6-regexp) | 925 | tramp-prefix-ipv6-regexp "\\(?:" tramp-ipv6-regexp "\\)?" |
| 921 | "\\(?:" tramp-ipv6-regexp "\\)?" | 926 | tramp-postfix-ipv6-regexp "\\)" |
| 922 | (tramp-postfix-ipv6-regexp) "\\)?" | 927 | "\\(?:" tramp-prefix-port-regexp tramp-port-regexp "\\)?" "\\)?")) |
| 923 | "\\(?:" tramp-prefix-port-regexp tramp-port-regexp "\\)?" "\\)?"))) | 928 | |
| 924 | 929 | (defvar tramp-remote-file-name-spec-regexp | |
| 925 | (defconst tramp-remote-file-name-spec-regexp-alist | 930 | (tramp-build-remote-file-name-spec-regexp) |
| 926 | `((default . ,(tramp-build-remote-file-name-spec-regexp 'default)) | 931 | "Regular expression matching a Tramp file name between prefix and postfix.") |
| 927 | (simplified . ,(tramp-build-remote-file-name-spec-regexp 'simplified)) | 932 | |
| 928 | (separate . ,(tramp-build-remote-file-name-spec-regexp 'separate))) | 933 | (defun tramp-build-file-name-structure () |
| 929 | "Alist mapping Tramp syntax to regexps matching Tramp file names.") | 934 | "Construct the Tramp file name structure for a Tramp syntax. |
| 930 | 935 | It is expected, that `tramp-syntax' has the proper value. | |
| 931 | (defun tramp-remote-file-name-spec-regexp () | ||
| 932 | "Regular expression matching a Tramp file name between prefix and postfix." | ||
| 933 | (tramp-lookup-syntax tramp-remote-file-name-spec-regexp-alist)) | ||
| 934 | |||
| 935 | (defun tramp-build-file-name-structure (syntax) | ||
| 936 | "Construct the Tramp file name structure for SYNTAX. | ||
| 937 | See `tramp-file-name-structure'." | 936 | See `tramp-file-name-structure'." |
| 938 | (let ((tramp-syntax syntax)) | 937 | (list |
| 939 | (list | 938 | (concat |
| 940 | (concat | 939 | tramp-prefix-regexp |
| 941 | (tramp-prefix-regexp) | 940 | "\\(" "\\(?:" tramp-remote-file-name-spec-regexp |
| 942 | "\\(" "\\(?:" (tramp-remote-file-name-spec-regexp) | 941 | tramp-postfix-hop-regexp "\\)+" "\\)?" |
| 943 | tramp-postfix-hop-regexp "\\)+" "\\)?" | 942 | tramp-remote-file-name-spec-regexp tramp-postfix-host-regexp |
| 944 | (tramp-remote-file-name-spec-regexp) (tramp-postfix-host-regexp) | 943 | "\\(" tramp-localname-regexp "\\)") |
| 945 | "\\(" tramp-localname-regexp "\\)") | 944 | 5 6 7 8 1)) |
| 946 | 5 6 7 8 1))) | 945 | |
| 947 | 946 | (defvar tramp-file-name-structure (tramp-build-file-name-structure) | |
| 948 | (defconst tramp-file-name-structure-alist | ||
| 949 | `((default . ,(tramp-build-file-name-structure 'default)) | ||
| 950 | (simplified . ,(tramp-build-file-name-structure 'simplified)) | ||
| 951 | (separate . ,(tramp-build-file-name-structure 'separate))) | ||
| 952 | "Alist mapping Tramp syntax to the file name structure for that syntax.") | ||
| 953 | |||
| 954 | (defun tramp-file-name-structure () | ||
| 955 | "List of six elements (REGEXP METHOD USER HOST FILE HOP), detailing \ | 947 | "List of six elements (REGEXP METHOD USER HOST FILE HOP), detailing \ |
| 956 | the Tramp file name structure. | 948 | the Tramp file name structure. |
| 957 | 949 | ||
| @@ -969,25 +961,22 @@ cascade of several hops. | |||
| 969 | These numbers are passed directly to `match-string', which see. That | 961 | These numbers are passed directly to `match-string', which see. That |
| 970 | means the opening parentheses are counted to identify the pair. | 962 | means the opening parentheses are counted to identify the pair. |
| 971 | 963 | ||
| 972 | See also `tramp-file-name-regexp'." | 964 | See also `tramp-file-name-regexp'.") |
| 973 | (tramp-lookup-syntax tramp-file-name-structure-alist)) | ||
| 974 | 965 | ||
| 975 | (defun tramp-file-name-regexp () | 966 | (defun tramp-build-file-name-regexp () |
| 976 | "Regular expression matching file names handled by Tramp. | 967 | (car tramp-file-name-structure)) |
| 977 | This regexp should match Tramp file names but no other file names." | ||
| 978 | (car (tramp-file-name-structure))) | ||
| 979 | 968 | ||
| 980 | ;;;###autoload | 969 | ;;;###autoload |
| 981 | (defconst tramp-initial-file-name-regexp "\\`/.+:.*:" | 970 | (defconst tramp-initial-file-name-regexp "\\`/.+:.*:" |
| 982 | "Value for `tramp-file-name-regexp' for autoload. | 971 | "Value for `tramp-file-name-regexp' for autoload. |
| 983 | It must match the initial `tramp-syntax' settings.") | 972 | It must match the initial `tramp-syntax' settings.") |
| 984 | 973 | ||
| 985 | ;; External packages use constant `tramp-file-name-regexp'. In order | ||
| 986 | ;; not to break them, we still provide it. It is a variable now. | ||
| 987 | ;;;###autoload | 974 | ;;;###autoload |
| 988 | (defvar tramp-file-name-regexp tramp-initial-file-name-regexp | 975 | (defvar tramp-file-name-regexp tramp-initial-file-name-regexp |
| 989 | "Value for `tramp-file-name-regexp' for autoload. | 976 | "Regular expression matching file names handled by Tramp. |
| 990 | It must match the initial `tramp-syntax' settings.") | 977 | This regexp should match Tramp file names but no other file |
| 978 | names. When calling `tramp-register-file-name-handlers', the | ||
| 979 | initial value is overwritten by the car of `tramp-file-name-structure'.") | ||
| 991 | 980 | ||
| 992 | ;;;###autoload | 981 | ;;;###autoload |
| 993 | (defconst tramp-completion-file-name-regexp-default | 982 | (defconst tramp-completion-file-name-regexp-default |
| @@ -1031,7 +1020,17 @@ On W32 systems, the volume letter must be ignored.") | |||
| 1031 | "Value for `tramp-completion-file-name-regexp' for separate remoting. | 1020 | "Value for `tramp-completion-file-name-regexp' for separate remoting. |
| 1032 | See `tramp-file-name-structure' for more explanations.") | 1021 | See `tramp-file-name-structure' for more explanations.") |
| 1033 | 1022 | ||
| 1034 | (defun tramp-completion-file-name-regexp () | 1023 | (defconst tramp-completion-file-name-regexp-alist |
| 1024 | `((default . ,tramp-completion-file-name-regexp-default) | ||
| 1025 | (simplified . ,tramp-completion-file-name-regexp-simplified) | ||
| 1026 | (separate . ,tramp-completion-file-name-regexp-separate)) | ||
| 1027 | "Alist mapping incomplete Tramp file names.") | ||
| 1028 | |||
| 1029 | (defun tramp-build-completion-file-name-regexp () | ||
| 1030 | (tramp-lookup-syntax tramp-completion-file-name-regexp-alist)) | ||
| 1031 | |||
| 1032 | (defvar tramp-completion-file-name-regexp | ||
| 1033 | (tramp-build-completion-file-name-regexp) | ||
| 1035 | "Regular expression matching file names handled by Tramp completion. | 1034 | "Regular expression matching file names handled by Tramp completion. |
| 1036 | This regexp should match partial Tramp file names only. | 1035 | This regexp should match partial Tramp file names only. |
| 1037 | 1036 | ||
| @@ -1040,14 +1039,7 @@ this file \(tramp.el) is loaded. This means that this variable must be set | |||
| 1040 | before loading tramp.el. Alternatively, `file-name-handler-alist' can be | 1039 | before loading tramp.el. Alternatively, `file-name-handler-alist' can be |
| 1041 | updated after changing this variable. | 1040 | updated after changing this variable. |
| 1042 | 1041 | ||
| 1043 | Also see `tramp-file-name-structure'." | 1042 | Also see `tramp-file-name-structure'.") |
| 1044 | (cond ((eq (tramp-compat-tramp-syntax) 'default) | ||
| 1045 | tramp-completion-file-name-regexp-default) | ||
| 1046 | ((eq (tramp-compat-tramp-syntax) 'simplified) | ||
| 1047 | tramp-completion-file-name-regexp-simplified) | ||
| 1048 | ((eq (tramp-compat-tramp-syntax) 'separate) | ||
| 1049 | tramp-completion-file-name-regexp-separate) | ||
| 1050 | (t (error "Wrong `tramp-syntax' %s" tramp-syntax)))) | ||
| 1051 | 1043 | ||
| 1052 | ;;;###autoload | 1044 | ;;;###autoload |
| 1053 | (defconst tramp-initial-completion-file-name-regexp | 1045 | (defconst tramp-initial-completion-file-name-regexp |
| @@ -1284,7 +1276,7 @@ entry does not exist, return nil." | |||
| 1284 | (if (memq system-type '(cygwin windows-nt)) | 1276 | (if (memq system-type '(cygwin windows-nt)) |
| 1285 | "^/[[:alpha:]]?:" "^/:") | 1277 | "^/[[:alpha:]]?:" "^/:") |
| 1286 | name)) | 1278 | name)) |
| 1287 | (string-match (tramp-file-name-regexp) name)))) | 1279 | (string-match tramp-file-name-regexp name)))) |
| 1288 | 1280 | ||
| 1289 | (defun tramp-find-method (method user host) | 1281 | (defun tramp-find-method (method user host) |
| 1290 | "Return the right method string to use. | 1282 | "Return the right method string to use. |
| @@ -1356,13 +1348,13 @@ values." | |||
| 1356 | (save-match-data | 1348 | (save-match-data |
| 1357 | (unless (tramp-tramp-file-p name) | 1349 | (unless (tramp-tramp-file-p name) |
| 1358 | (tramp-compat-user-error nil "Not a Tramp file name: \"%s\"" name)) | 1350 | (tramp-compat-user-error nil "Not a Tramp file name: \"%s\"" name)) |
| 1359 | (if (not (string-match (nth 0 (tramp-file-name-structure)) name)) | 1351 | (if (not (string-match (nth 0 tramp-file-name-structure) name)) |
| 1360 | (error "`tramp-file-name-structure' didn't match!") | 1352 | (error "`tramp-file-name-structure' didn't match!") |
| 1361 | (let ((method (match-string (nth 1 (tramp-file-name-structure)) name)) | 1353 | (let ((method (match-string (nth 1 tramp-file-name-structure) name)) |
| 1362 | (user (match-string (nth 2 (tramp-file-name-structure)) name)) | 1354 | (user (match-string (nth 2 tramp-file-name-structure) name)) |
| 1363 | (host (match-string (nth 3 (tramp-file-name-structure)) name)) | 1355 | (host (match-string (nth 3 tramp-file-name-structure) name)) |
| 1364 | (localname (match-string (nth 4 (tramp-file-name-structure)) name)) | 1356 | (localname (match-string (nth 4 tramp-file-name-structure) name)) |
| 1365 | (hop (match-string (nth 5 (tramp-file-name-structure)) name)) | 1357 | (hop (match-string (nth 5 tramp-file-name-structure) name)) |
| 1366 | domain port) | 1358 | domain port) |
| 1367 | (when user | 1359 | (when user |
| 1368 | (when (string-match tramp-user-with-domain-regexp user) | 1360 | (when (string-match tramp-user-with-domain-regexp user) |
| @@ -1373,9 +1365,9 @@ values." | |||
| 1373 | (when (string-match tramp-host-with-port-regexp host) | 1365 | (when (string-match tramp-host-with-port-regexp host) |
| 1374 | (setq port (match-string 2 host) | 1366 | (setq port (match-string 2 host) |
| 1375 | host (match-string 1 host))) | 1367 | host (match-string 1 host))) |
| 1376 | (when (string-match (tramp-prefix-ipv6-regexp) host) | 1368 | (when (string-match tramp-prefix-ipv6-regexp host) |
| 1377 | (setq host (replace-match "" nil t host))) | 1369 | (setq host (replace-match "" nil t host))) |
| 1378 | (when (string-match (tramp-postfix-ipv6-regexp) host) | 1370 | (when (string-match tramp-postfix-ipv6-regexp host) |
| 1379 | (setq host (replace-match "" nil t host)))) | 1371 | (setq host (replace-match "" nil t host)))) |
| 1380 | 1372 | ||
| 1381 | (unless nodefault | 1373 | (unless nodefault |
| @@ -1400,42 +1392,41 @@ values." | |||
| 1400 | (method user domain host port localname &optional hop) | 1392 | (method user domain host port localname &optional hop) |
| 1401 | "Constructs a Tramp file name from METHOD, USER, HOST and LOCALNAME. | 1393 | "Constructs a Tramp file name from METHOD, USER, HOST and LOCALNAME. |
| 1402 | When not nil, optional DOMAIN, PORT and HOP are used." | 1394 | When not nil, optional DOMAIN, PORT and HOP are used." |
| 1403 | (concat (tramp-prefix-format) hop | 1395 | (concat tramp-prefix-format hop |
| 1404 | (unless (or (zerop (length method)) | 1396 | (unless (or (zerop (length method)) |
| 1405 | (zerop (length (tramp-postfix-method-format)))) | 1397 | (zerop (length tramp-postfix-method-format))) |
| 1406 | (concat method (tramp-postfix-method-format))) | 1398 | (concat method tramp-postfix-method-format)) |
| 1407 | user | 1399 | user |
| 1408 | (unless (zerop (length domain)) | 1400 | (unless (zerop (length domain)) |
| 1409 | (concat tramp-prefix-domain-format domain)) | 1401 | (concat tramp-prefix-domain-format domain)) |
| 1410 | (unless (zerop (length user)) | 1402 | (unless (zerop (length user)) |
| 1411 | tramp-postfix-user-format) | 1403 | tramp-postfix-user-format) |
| 1412 | (when host | 1404 | (when host |
| 1413 | (if (string-match tramp-ipv6-regexp host) | 1405 | (if (string-match tramp-ipv6-regexp host) |
| 1414 | (concat | 1406 | (concat tramp-prefix-ipv6-format host tramp-postfix-ipv6-format) |
| 1415 | (tramp-prefix-ipv6-format) host (tramp-postfix-ipv6-format)) | ||
| 1416 | host)) | 1407 | host)) |
| 1417 | (unless (zerop (length port)) | 1408 | (unless (zerop (length port)) |
| 1418 | (concat tramp-prefix-port-format port)) | 1409 | (concat tramp-prefix-port-format port)) |
| 1419 | (tramp-postfix-host-format) | 1410 | tramp-postfix-host-format |
| 1420 | (when localname localname))) | 1411 | (when localname localname))) |
| 1421 | 1412 | ||
| 1422 | (defun tramp-completion-make-tramp-file-name (method user host localname) | 1413 | (defun tramp-completion-make-tramp-file-name (method user host localname) |
| 1423 | "Constructs a Tramp file name from METHOD, USER, HOST and LOCALNAME. | 1414 | "Constructs a Tramp file name from METHOD, USER, HOST and LOCALNAME. |
| 1424 | It must not be a complete Tramp file name, but as long as there are | 1415 | It must not be a complete Tramp file name, but as long as there are |
| 1425 | necessary only. This function will be used in file name completion." | 1416 | necessary only. This function will be used in file name completion." |
| 1426 | (concat (tramp-prefix-format) | 1417 | (concat tramp-prefix-format |
| 1427 | (unless (or (zerop (length method)) | 1418 | (unless (or (zerop (length method)) |
| 1428 | (zerop (length (tramp-postfix-method-format)))) | 1419 | (zerop (length tramp-postfix-method-format))) |
| 1429 | (concat method (tramp-postfix-method-format))) | 1420 | (concat method tramp-postfix-method-format)) |
| 1430 | (unless (zerop (length user)) | 1421 | (unless (zerop (length user)) |
| 1431 | (concat user tramp-postfix-user-format)) | 1422 | (concat user tramp-postfix-user-format)) |
| 1432 | (unless (zerop (length host)) | 1423 | (unless (zerop (length host)) |
| 1433 | (concat | 1424 | (concat |
| 1434 | (if (string-match tramp-ipv6-regexp host) | 1425 | (if (string-match tramp-ipv6-regexp host) |
| 1435 | (concat | 1426 | (concat |
| 1436 | (tramp-prefix-ipv6-format) host (tramp-postfix-ipv6-format)) | 1427 | tramp-prefix-ipv6-format host tramp-postfix-ipv6-format) |
| 1437 | host) | 1428 | host) |
| 1438 | (tramp-postfix-host-format))) | 1429 | tramp-postfix-host-format)) |
| 1439 | (when localname localname))) | 1430 | (when localname localname))) |
| 1440 | 1431 | ||
| 1441 | (defun tramp-get-buffer (vec) | 1432 | (defun tramp-get-buffer (vec) |
| @@ -1947,7 +1938,7 @@ special handling of `substitute-in-file-name'." | |||
| 1947 | 'tramp-rfn-eshadow-setup-minibuffer))) | 1938 | 'tramp-rfn-eshadow-setup-minibuffer))) |
| 1948 | 1939 | ||
| 1949 | (defun tramp-rfn-eshadow-update-overlay-regexp () | 1940 | (defun tramp-rfn-eshadow-update-overlay-regexp () |
| 1950 | (format "[^%s/~]*\\(/\\|~\\)" (tramp-postfix-host-format))) | 1941 | (format "[^%s/~]*\\(/\\|~\\)" tramp-postfix-host-format)) |
| 1951 | 1942 | ||
| 1952 | (defun tramp-rfn-eshadow-update-overlay () | 1943 | (defun tramp-rfn-eshadow-update-overlay () |
| 1953 | "Update `rfn-eshadow-overlay' to cover shadowed part of minibuffer input. | 1944 | "Update `rfn-eshadow-overlay' to cover shadowed part of minibuffer input. |
| @@ -2365,11 +2356,11 @@ remote file names." | |||
| 2365 | ;; property of `tramp-file-name-handler', this shall be done by the | 2356 | ;; property of `tramp-file-name-handler', this shall be done by the |
| 2366 | ;; respective foreign handlers. | 2357 | ;; respective foreign handlers. |
| 2367 | (add-to-list 'file-name-handler-alist | 2358 | (add-to-list 'file-name-handler-alist |
| 2368 | (cons (tramp-file-name-regexp) 'tramp-file-name-handler)) | 2359 | (cons tramp-file-name-regexp 'tramp-file-name-handler)) |
| 2369 | (put 'tramp-file-name-handler 'safe-magic t) | 2360 | (put 'tramp-file-name-handler 'safe-magic t) |
| 2370 | 2361 | ||
| 2371 | (add-to-list 'file-name-handler-alist | 2362 | (add-to-list 'file-name-handler-alist |
| 2372 | (cons (tramp-completion-file-name-regexp) | 2363 | (cons tramp-completion-file-name-regexp |
| 2373 | 'tramp-completion-file-name-handler)) | 2364 | 'tramp-completion-file-name-handler)) |
| 2374 | (put 'tramp-completion-file-name-handler 'safe-magic t) | 2365 | (put 'tramp-completion-file-name-handler 'safe-magic t) |
| 2375 | ;; Mark `operations' the handler is responsible for. | 2366 | ;; Mark `operations' the handler is responsible for. |
| @@ -2473,8 +2464,8 @@ not in completion mode." | |||
| 2473 | ;; Suppress hop from completion. | 2464 | ;; Suppress hop from completion. |
| 2474 | (when (string-match | 2465 | (when (string-match |
| 2475 | (concat | 2466 | (concat |
| 2476 | (tramp-prefix-regexp) | 2467 | tramp-prefix-regexp |
| 2477 | "\\(" "\\(" (tramp-remote-file-name-spec-regexp) | 2468 | "\\(" "\\(" tramp-remote-file-name-spec-regexp |
| 2478 | tramp-postfix-hop-regexp | 2469 | tramp-postfix-hop-regexp |
| 2479 | "\\)+" "\\)") | 2470 | "\\)+" "\\)") |
| 2480 | fullname) | 2471 | fullname) |
| @@ -2519,9 +2510,8 @@ not in completion mode." | |||
| 2519 | ;; Unify list, add hop, remove nil elements. | 2510 | ;; Unify list, add hop, remove nil elements. |
| 2520 | (dolist (elt result) | 2511 | (dolist (elt result) |
| 2521 | (when elt | 2512 | (when elt |
| 2522 | (string-match (tramp-prefix-regexp) elt) | 2513 | (string-match tramp-prefix-regexp elt) |
| 2523 | (setq elt | 2514 | (setq elt (replace-match (concat tramp-prefix-format hop) nil nil elt)) |
| 2524 | (replace-match (concat (tramp-prefix-format) hop) nil nil elt)) | ||
| 2525 | (push | 2515 | (push |
| 2526 | (substring elt (length (tramp-drop-volume-letter directory))) | 2516 | (substring elt (length (tramp-drop-volume-letter directory))) |
| 2527 | result1))) | 2517 | result1))) |
| @@ -2569,58 +2559,58 @@ They are collected by `tramp-completion-dissect-file-name1'." | |||
| 2569 | (tramp-completion-ipv6-regexp | 2559 | (tramp-completion-ipv6-regexp |
| 2570 | (format | 2560 | (format |
| 2571 | "[^%s]*" | 2561 | "[^%s]*" |
| 2572 | (if (zerop (length (tramp-postfix-ipv6-format))) | 2562 | (if (zerop (length tramp-postfix-ipv6-format)) |
| 2573 | (tramp-postfix-host-format) | 2563 | tramp-postfix-host-format |
| 2574 | (tramp-postfix-ipv6-format)))) | 2564 | tramp-postfix-ipv6-format))) |
| 2575 | ;; "/method" "/[method" | 2565 | ;; "/method" "/[method" |
| 2576 | (tramp-completion-file-name-structure1 | 2566 | (tramp-completion-file-name-structure1 |
| 2577 | (list | 2567 | (list |
| 2578 | (concat | 2568 | (concat |
| 2579 | (tramp-prefix-regexp) | 2569 | tramp-prefix-regexp |
| 2580 | "\\(" (tramp-method-regexp) x-nil "\\)$") | 2570 | "\\(" tramp-method-regexp x-nil "\\)$") |
| 2581 | 1 nil nil nil)) | 2571 | 1 nil nil nil)) |
| 2582 | ;; "/method:user" "/[method/user" | 2572 | ;; "/method:user" "/[method/user" |
| 2583 | (tramp-completion-file-name-structure2 | 2573 | (tramp-completion-file-name-structure2 |
| 2584 | (list | 2574 | (list |
| 2585 | (concat | 2575 | (concat |
| 2586 | (tramp-prefix-regexp) | 2576 | tramp-prefix-regexp |
| 2587 | "\\(" (tramp-method-regexp) "\\)" (tramp-postfix-method-regexp) | 2577 | "\\(" tramp-method-regexp "\\)" tramp-postfix-method-regexp |
| 2588 | "\\(" tramp-user-regexp x-nil "\\)$") | 2578 | "\\(" tramp-user-regexp x-nil "\\)$") |
| 2589 | 1 2 nil nil)) | 2579 | 1 2 nil nil)) |
| 2590 | ;; "/method:host" "/[method/host" | 2580 | ;; "/method:host" "/[method/host" |
| 2591 | (tramp-completion-file-name-structure3 | 2581 | (tramp-completion-file-name-structure3 |
| 2592 | (list | 2582 | (list |
| 2593 | (concat | 2583 | (concat |
| 2594 | (tramp-prefix-regexp) | 2584 | tramp-prefix-regexp |
| 2595 | "\\(" (tramp-method-regexp) "\\)" (tramp-postfix-method-regexp) | 2585 | "\\(" tramp-method-regexp "\\)" tramp-postfix-method-regexp |
| 2596 | "\\(" tramp-host-regexp x-nil "\\)$") | 2586 | "\\(" tramp-host-regexp x-nil "\\)$") |
| 2597 | 1 nil 2 nil)) | 2587 | 1 nil 2 nil)) |
| 2598 | ;; "/method:[ipv6" "/[method/ipv6" | 2588 | ;; "/method:[ipv6" "/[method/ipv6" |
| 2599 | (tramp-completion-file-name-structure4 | 2589 | (tramp-completion-file-name-structure4 |
| 2600 | (list | 2590 | (list |
| 2601 | (concat | 2591 | (concat |
| 2602 | (tramp-prefix-regexp) | 2592 | tramp-prefix-regexp |
| 2603 | "\\(" (tramp-method-regexp) "\\)" (tramp-postfix-method-regexp) | 2593 | "\\(" tramp-method-regexp "\\)" tramp-postfix-method-regexp |
| 2604 | (tramp-prefix-ipv6-regexp) | 2594 | tramp-prefix-ipv6-regexp |
| 2605 | "\\(" tramp-completion-ipv6-regexp x-nil "\\)$") | 2595 | "\\(" tramp-completion-ipv6-regexp x-nil "\\)$") |
| 2606 | 1 nil 2 nil)) | 2596 | 1 nil 2 nil)) |
| 2607 | ;; "/method:user@host" "/[method/user@host" | 2597 | ;; "/method:user@host" "/[method/user@host" |
| 2608 | (tramp-completion-file-name-structure5 | 2598 | (tramp-completion-file-name-structure5 |
| 2609 | (list | 2599 | (list |
| 2610 | (concat | 2600 | (concat |
| 2611 | (tramp-prefix-regexp) | 2601 | tramp-prefix-regexp |
| 2612 | "\\(" (tramp-method-regexp) "\\)" (tramp-postfix-method-regexp) | 2602 | "\\(" tramp-method-regexp "\\)" tramp-postfix-method-regexp |
| 2613 | "\\(" tramp-user-regexp "\\)" tramp-postfix-user-regexp | 2603 | "\\(" tramp-user-regexp "\\)" tramp-postfix-user-regexp |
| 2614 | "\\(" tramp-host-regexp x-nil "\\)$") | 2604 | "\\(" tramp-host-regexp x-nil "\\)$") |
| 2615 | 1 2 3 nil)) | 2605 | 1 2 3 nil)) |
| 2616 | ;; "/method:user@[ipv6" "/[method/user@ipv6" | 2606 | ;; "/method:user@[ipv6" "/[method/user@ipv6" |
| 2617 | (tramp-completion-file-name-structure6 | 2607 | (tramp-completion-file-name-structure6 |
| 2618 | (list | 2608 | (list |
| 2619 | (concat | 2609 | (concat |
| 2620 | (tramp-prefix-regexp) | 2610 | tramp-prefix-regexp |
| 2621 | "\\(" (tramp-method-regexp) "\\)" (tramp-postfix-method-regexp) | 2611 | "\\(" tramp-method-regexp "\\)" tramp-postfix-method-regexp |
| 2622 | "\\(" tramp-user-regexp "\\)" tramp-postfix-user-regexp | 2612 | "\\(" tramp-user-regexp "\\)" tramp-postfix-user-regexp |
| 2623 | (tramp-prefix-ipv6-regexp) | 2613 | tramp-prefix-ipv6-regexp |
| 2624 | "\\(" tramp-completion-ipv6-regexp x-nil "\\)$") | 2614 | "\\(" tramp-completion-ipv6-regexp x-nil "\\)$") |
| 2625 | 1 2 3 nil))) | 2615 | 1 2 3 nil))) |
| 2626 | (delq | 2616 | (delq |
| @@ -4479,10 +4469,10 @@ Invokes `password-read' if available, `read-passwd' else." | |||
| 4479 | (tramp-clear-passwd | 4469 | (tramp-clear-passwd |
| 4480 | (tramp-dissect-file-name | 4470 | (tramp-dissect-file-name |
| 4481 | (concat | 4471 | (concat |
| 4482 | (tramp-prefix-format) | 4472 | tramp-prefix-format |
| 4483 | (replace-regexp-in-string | 4473 | (replace-regexp-in-string |
| 4484 | (concat tramp-postfix-hop-regexp "$") | 4474 | (concat tramp-postfix-hop-regexp "$") |
| 4485 | (tramp-postfix-host-format) hop))))) | 4475 | tramp-postfix-host-format hop))))) |
| 4486 | (auth-source-forget | 4476 | (auth-source-forget |
| 4487 | `(:max 1 ,(and user-domain :user) ,user-domain | 4477 | `(:max 1 ,(and user-domain :user) ,user-domain |
| 4488 | :host ,host-port :port ,method)) | 4478 | :host ,host-port :port ,method)) |
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index 4139d50ff01..13e2e30cab4 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el | |||
| @@ -2852,16 +2852,16 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 2852 | (tramp-change-syntax syntax) | 2852 | (tramp-change-syntax syntax) |
| 2853 | (let ;; This is needed for the `simplified' syntax. | 2853 | (let ;; This is needed for the `simplified' syntax. |
| 2854 | ((method-marker | 2854 | ((method-marker |
| 2855 | (if (zerop (length (tramp-method-regexp))) | 2855 | (if (zerop (length tramp-method-regexp)) |
| 2856 | "" tramp-default-method-marker)) | 2856 | "" tramp-default-method-marker)) |
| 2857 | ;; This is needed for the `separate' syntax. | 2857 | ;; This is needed for the `separate' syntax. |
| 2858 | (prefix-format (substring (tramp-prefix-format) 1))) | 2858 | (prefix-format (substring tramp-prefix-format 1))) |
| 2859 | ;; Complete method name. | 2859 | ;; Complete method name. |
| 2860 | (unless (or (zerop (length method)) | 2860 | (unless (or (zerop (length method)) |
| 2861 | (zerop (length (tramp-method-regexp)))) | 2861 | (zerop (length tramp-method-regexp))) |
| 2862 | (should | 2862 | (should |
| 2863 | (member | 2863 | (member |
| 2864 | (concat prefix-format method (tramp-postfix-method-format)) | 2864 | (concat prefix-format method tramp-postfix-method-format) |
| 2865 | (file-name-all-completions | 2865 | (file-name-all-completions |
| 2866 | (concat prefix-format (substring method 0 1)) "/")))) | 2866 | (concat prefix-format (substring method 0 1)) "/")))) |
| 2867 | ;; Complete host name for default method. With gvfs | 2867 | ;; Complete host name for default method. With gvfs |
| @@ -2873,25 +2873,25 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 2873 | (should | 2873 | (should |
| 2874 | (member | 2874 | (member |
| 2875 | (concat | 2875 | (concat |
| 2876 | prefix-format method-marker (tramp-postfix-method-format) | 2876 | prefix-format method-marker tramp-postfix-method-format |
| 2877 | host (tramp-postfix-host-format)) | 2877 | host tramp-postfix-host-format) |
| 2878 | (file-name-all-completions | 2878 | (file-name-all-completions |
| 2879 | (concat | 2879 | (concat |
| 2880 | prefix-format method-marker (tramp-postfix-method-format) | 2880 | prefix-format method-marker tramp-postfix-method-format |
| 2881 | (substring host 0 1)) | 2881 | (substring host 0 1)) |
| 2882 | "/"))))) | 2882 | "/"))))) |
| 2883 | ;; Complete host name. | 2883 | ;; Complete host name. |
| 2884 | (unless (or (zerop (length method)) | 2884 | (unless (or (zerop (length method)) |
| 2885 | (zerop (length (tramp-method-regexp))) | 2885 | (zerop (length tramp-method-regexp)) |
| 2886 | (zerop (length host)) | 2886 | (zerop (length host)) |
| 2887 | (tramp--test-gvfs-p method)) | 2887 | (tramp--test-gvfs-p method)) |
| 2888 | (should | 2888 | (should |
| 2889 | (member | 2889 | (member |
| 2890 | (concat | 2890 | (concat |
| 2891 | prefix-format method (tramp-postfix-method-format) | 2891 | prefix-format method tramp-postfix-method-format |
| 2892 | host (tramp-postfix-host-format)) | 2892 | host tramp-postfix-host-format) |
| 2893 | (file-name-all-completions | 2893 | (file-name-all-completions |
| 2894 | (concat prefix-format method (tramp-postfix-method-format)) | 2894 | (concat prefix-format method tramp-postfix-method-format) |
| 2895 | "/")))))) | 2895 | "/")))))) |
| 2896 | 2896 | ||
| 2897 | ;; Cleanup. | 2897 | ;; Cleanup. |