[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 8d96fea: Tuning for `separate' Tramp syntax
From: |
Michael Albinus |
Subject: |
[Emacs-diffs] master 8d96fea: Tuning for `separate' Tramp syntax |
Date: |
Sun, 16 Apr 2017 10:51:35 -0400 (EDT) |
branch: master
commit 8d96feae07c618f591a952f8f10ae949735b4050
Author: Michael Albinus <address@hidden>
Commit: Michael Albinus <address@hidden>
Tuning for `separate' Tramp syntax
* lisp/net/tramp.el (tramp-method-regexp): Fix it for `separate' syntax.
(tramp-completion-file-name-regexp-separate): Simplify.
* test/lisp/net/tramp-tests.el (tramp-test02-file-name-dissect-separate):
Extend test.
---
lisp/net/tramp.el | 9 ++-
test/lisp/net/tramp-tests.el | 151 ++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 156 insertions(+), 4 deletions(-)
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 12169d4..9b80c59 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -717,7 +717,10 @@ Should always start with \"^\". Derived from
`tramp-prefix-format'."
(defun tramp-method-regexp ()
"Regexp matching methods identifiers.
The `ftp' syntax does not support methods."
- (if (eq (tramp-compat-tramp-syntax) 'simplified) "" "[a-zA-Z0-9-]+"))
+ (cond ((eq (tramp-compat-tramp-syntax) 'default) "[a-zA-Z0-9-]+")
+ ((eq (tramp-compat-tramp-syntax) 'simplified) "")
+ ((eq (tramp-compat-tramp-syntax) 'separate) "[a-zA-Z0-9-]*")
+ (t (error "Wrong `tramp-syntax' %s" tramp-syntax))))
(defun tramp-postfix-method-format ()
"String matching delimiter between method and user or host names.
@@ -942,7 +945,7 @@ See `tramp-file-name-structure' for more explanations.
On W32 systems, the volume letter must be ignored.")
(defconst tramp-completion-file-name-regexp-separate
- "\\`/\\[\\([^]]*\\)?\\'"
+ "\\`/\\[[^]]*\\'"
"Value for `tramp-completion-file-name-regexp' for separate remoting.
See `tramp-file-name-structure' for more explanations.")
@@ -2306,7 +2309,7 @@ not in completion mode."
;; Method, host name and user name completion.
;; `tramp-completion-dissect-file-name' returns a list of
-;; tramp-file-name structures. For all of them we return possible completions.
+;; tramp-file-name structures. For all of them we return possible completions.
(defun tramp-completion-handle-file-name-all-completions (filename directory)
"Like `file-name-all-completions' for partial Tramp files."
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index 9dcb3ec..1d487bc 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -764,7 +764,7 @@ handled properly. BODY shall not contain a timeout."
(file-remote-p "/address@hidden:" 'localname) ""))
(should (string-equal (file-remote-p "/address@hidden:" 'hop) nil))
- ;; Expand `tramp-default-method' and `tramp-default-user'.
+ ;; Expand `tramp-default-method' and `tramp-default-user'.
(should (string-equal
(file-remote-p "/1.2.3.4:")
(format "/address@hidden:" "default-user" "1.2.3.4")))
@@ -961,6 +961,43 @@ handled properly. BODY shall not contain a timeout."
;; Expand `tramp-default-method' and `tramp-default-user'.
(should (string-equal
+ (file-remote-p "/[/host]")
+ (format
+ "/[%s/address@hidden" "default-method" "default-user"
"host")))
+ (should (string-equal
+ (file-remote-p "/[/host]" 'method) "default-method"))
+ (should (string-equal
+ (file-remote-p "/[/host]" 'user) "default-user"))
+ (should (string-equal (file-remote-p "/[/host]" 'host) "host"))
+ (should (string-equal (file-remote-p "/[/host]" 'localname) ""))
+ (should (string-equal (file-remote-p "/[/host]" 'hop) nil))
+
+ ;; Expand `tramp-default-method' and `tramp-default-host'.
+ (should (string-equal
+ (file-remote-p "/[/address@hidden")
+ (format
+ "/[%s/address@hidden" "default-method" "user"
"default-host")))
+ (should (string-equal
+ (file-remote-p "/[/address@hidden" 'method)
"default-method"))
+ (should (string-equal (file-remote-p "/[/address@hidden" 'user)
"user"))
+ (should (string-equal
+ (file-remote-p "/[/address@hidden" 'host) "default-host"))
+ (should (string-equal (file-remote-p "/[/address@hidden" 'localname)
""))
+ (should (string-equal (file-remote-p "/[/address@hidden" 'hop) nil))
+
+ ;; Expand `tramp-default-method'.
+ (should (string-equal
+ (file-remote-p "/[/address@hidden")
+ (format "/[%s/address@hidden" "default-method" "user"
"host")))
+ (should (string-equal
+ (file-remote-p "/[/address@hidden" 'method)
"default-method"))
+ (should (string-equal (file-remote-p "/[/address@hidden" 'user)
"user"))
+ (should (string-equal (file-remote-p "/[/address@hidden" 'host)
"host"))
+ (should (string-equal (file-remote-p "/[/address@hidden" 'localname)
""))
+ (should (string-equal (file-remote-p "/[/address@hidden" 'hop) nil))
+
+ ;; Expand `tramp-default-method' and `tramp-default-user'.
+ (should (string-equal
(file-remote-p "/[-/host]")
(format
"/[%s/address@hidden" "default-method" "default-user"
"host")))
@@ -1055,6 +1092,36 @@ handled properly. BODY shall not contain a timeout."
;; Expand `tramp-default-method' and `tramp-default-user'.
(should (string-equal
+ (file-remote-p "/[/host#1234]")
+ (format
+ "/[%s/address@hidden" "default-method" "default-user"
"host#1234")))
+ (should (string-equal
+ (file-remote-p "/[/host#1234]" 'method) "default-method"))
+ (should (string-equal
+ (file-remote-p "/[/host#1234]" 'user) "default-user"))
+ (should (string-equal
+ (file-remote-p "/[/host#1234]" 'host) "host#1234"))
+ (should (string-equal (file-remote-p "/[/host#1234]" 'localname) ""))
+ (should (string-equal (file-remote-p "/[/host#1234]" 'hop) nil))
+
+ ;; Expand `tramp-default-method'.
+ (should (string-equal
+ (file-remote-p "/[/address@hidden")
+ (format "/[%s/address@hidden" "default-method" "user"
"host#1234")))
+ (should (string-equal
+ (file-remote-p
+ "/[/address@hidden" 'method) "default-method"))
+ (should (string-equal
+ (file-remote-p
+ "/[/address@hidden" 'user) "user"))
+ (should (string-equal
+ (file-remote-p "/[/address@hidden" 'host) "host#1234"))
+ (should (string-equal
+ (file-remote-p "/[/address@hidden" 'localname) ""))
+ (should (string-equal (file-remote-p "/[/address@hidden" 'hop) nil))
+
+ ;; Expand `tramp-default-method' and `tramp-default-user'.
+ (should (string-equal
(file-remote-p "/[-/host#1234]")
(format
"/[%s/address@hidden" "default-method" "default-user"
"host#1234")))
@@ -1115,6 +1182,35 @@ handled properly. BODY shall not contain a timeout."
;; Expand `tramp-default-method' and `tramp-default-user'.
(should (string-equal
+ (file-remote-p "/[/1.2.3.4]")
+ (format
+ "/[%s/address@hidden" "default-method" "default-user"
"1.2.3.4")))
+ (should (string-equal
+ (file-remote-p "/[/1.2.3.4]" 'method) "default-method"))
+ (should (string-equal
+ (file-remote-p "/[/1.2.3.4]" 'user) "default-user"))
+ (should (string-equal
+ (file-remote-p "/[/1.2.3.4]" 'host) "1.2.3.4"))
+ (should (string-equal (file-remote-p "/[/1.2.3.4]" 'localname) ""))
+ (should (string-equal (file-remote-p "/[/1.2.3.4]" 'hop) nil))
+
+ ;; Expand `tramp-default-method'.
+ (should (string-equal
+ (file-remote-p "/[/address@hidden")
+ (format "/[%s/address@hidden" "default-method" "user"
"1.2.3.4")))
+ (should (string-equal
+ (file-remote-p
+ "/[/address@hidden" 'method) "default-method"))
+ (should (string-equal
+ (file-remote-p "/[/address@hidden" 'user) "user"))
+ (should (string-equal
+ (file-remote-p "/[/address@hidden" 'host) "1.2.3.4"))
+ (should (string-equal
+ (file-remote-p "/[/address@hidden" 'localname) ""))
+ (should (string-equal (file-remote-p "/[/address@hidden" 'hop) nil))
+
+ ;; Expand `tramp-default-method' and `tramp-default-user'.
+ (should (string-equal
(file-remote-p "/[-/1.2.3.4]")
(format
"/[%s/address@hidden" "default-method" "default-user"
"1.2.3.4")))
@@ -1174,6 +1270,58 @@ handled properly. BODY shall not contain a timeout."
;; Expand `tramp-default-method', `tramp-default-user' and
;; `tramp-default-host'.
(should (string-equal
+ (file-remote-p "/[/]")
+ (format
+ "/[%s/address@hidden"
+ "default-method" "default-user" "default-host")))
+ (should (string-equal
+ (file-remote-p "/[/]" 'method) "default-method"))
+ (should (string-equal (file-remote-p "/[/]" 'user) "default-user"))
+ (should (string-equal (file-remote-p "/[/]" 'host) "default-host"))
+ (should (string-equal (file-remote-p "/[/]" 'localname) ""))
+ (should (string-equal (file-remote-p "/[/]" 'hop) nil))
+
+ ;; Expand `tramp-default-method' and `tramp-default-user'.
+ (let ((tramp-default-host "::1"))
+ (should (string-equal
+ (file-remote-p "/[/]")
+ (format
+ "/[%s/address@hidden"
+ "default-method" "default-user" "::1")))
+ (should (string-equal
+ (file-remote-p "/[/]" 'method) "default-method"))
+ (should (string-equal (file-remote-p "/[/]" 'user) "default-user"))
+ (should (string-equal (file-remote-p "/[/]" 'host) "::1"))
+ (should (string-equal (file-remote-p "/[/]" 'localname) ""))
+ (should (string-equal (file-remote-p "/[/]" 'hop) nil)))
+
+ ;; Expand `tramp-default-method' and `tramp-default-user'.
+ (should (string-equal
+ (file-remote-p "/[/::1]")
+ (format
+ "/[%s/address@hidden" "default-method" "default-user"
"::1")))
+ (should (string-equal
+ (file-remote-p "/[/::1]" 'method) "default-method"))
+ (should (string-equal
+ (file-remote-p "/[/::1]" 'user) "default-user"))
+ (should (string-equal (file-remote-p "/[/::1]" 'host) "::1"))
+ (should (string-equal (file-remote-p "/[/::1]" 'localname) ""))
+ (should (string-equal (file-remote-p "/[/::1]" 'hop) nil))
+
+ ;; Expand `tramp-default-method'.
+ (should (string-equal
+ (file-remote-p "/[/user@::1]")
+ (format "/[%s/address@hidden" "default-method" "user"
"::1")))
+ (should (string-equal
+ (file-remote-p "/[/user@::1]" 'method) "default-method"))
+ (should (string-equal (file-remote-p "/[/user@::1]" 'user) "user"))
+ (should (string-equal (file-remote-p "/[/user@::1]" 'host) "::1"))
+ (should (string-equal (file-remote-p "/[/user@::1]" 'localname) ""))
+ (should (string-equal (file-remote-p "/[/user@::1]" 'hop) nil))
+
+ ;; Expand `tramp-default-method', `tramp-default-user' and
+ ;; `tramp-default-host'.
+ (should (string-equal
(file-remote-p "/[-/]")
(format
"/[%s/address@hidden"
@@ -1250,6 +1398,7 @@ handled properly. BODY shall not contain a timeout."
(should (string-equal (file-remote-p "/[method/user@::1]" 'hop) nil))
;; Local file name part.
+ (should (string-equal (file-remote-p "/[/host]/:" 'localname) "/:"))
(should (string-equal (file-remote-p "/[-/host]/:" 'localname) "/:"))
(should (string-equal (file-remote-p "/[method/]:" 'localname) ":"))
(should (string-equal (file-remote-p "/[method/] " 'localname) " "))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master 8d96fea: Tuning for `separate' Tramp syntax,
Michael Albinus <=