Commit 1486fa31 authored by Michael Albinus's avatar Michael Albinus
Browse files

Remove URL syntax.

* net/tramp.el (tramp-syntax, tramp-prefix-format)
(tramp-postfix-method-format, tramp-prefix-ipv6-format)
(tramp-postfix-ipv6-format, tramp-prefix-port-format)
(tramp-postfix-host-format, tramp-file-name-regexp)
(tramp-completion-file-name-regexp)
(tramp-completion-dissect-file-name)
(tramp-handle-substitute-in-file-name): Remove 'url case.
(tramp-file-name-regexp-url)
(tramp-completion-file-name-regexp-url): Remove constants.
parent 8bda01d3
2013-09-06 Michael Albinus <michael.albinus@gmx.de>
Remove URL syntax.
* net/tramp.el (tramp-syntax, tramp-prefix-format)
(tramp-postfix-method-format, tramp-prefix-ipv6-format)
(tramp-postfix-ipv6-format, tramp-prefix-port-format)
(tramp-postfix-host-format, tramp-file-name-regexp)
(tramp-completion-file-name-regexp)
(tramp-completion-dissect-file-name)
(tramp-handle-substitute-in-file-name): Remove 'url case.
(tramp-file-name-regexp-url)
(tramp-completion-file-name-regexp-url): Remove constants.
2013-09-06 Glenn Morris <rgm@gnu.org>
* replace.el (replace-string): Doc fix re start/end. (Bug#15275)
......
......@@ -690,7 +690,7 @@ Useful for \"rsync\" like methods.")
;; Tramp only knows how to deal with `file-name-handler-alist', not
;; the other places.
;; Currently, we have the choice between 'ftp, 'sep, and 'url.
;; Currently, we have the choice between 'ftp and 'sep.
;;;###autoload
(defcustom tramp-syntax
(if (featurep 'xemacs) 'sep 'ftp)
......@@ -699,20 +699,15 @@ Useful for \"rsync\" like methods.")
It can have the following values:
'ftp -- Ange-FTP respective EFS like syntax (GNU Emacs default)
'sep -- Syntax as defined for XEmacs (not available yet for GNU Emacs)
'url -- URL-like syntax."
'sep -- Syntax as defined for XEmacs."
:group 'tramp
:type (if (featurep 'xemacs)
'(choice (const :tag "EFS" ftp)
(const :tag "XEmacs" sep)
(const :tag "URL" url))
'(choice (const :tag "Ange-FTP" ftp)
(const :tag "URL" url))))
:version "24.4"
:type `(choice (const :tag ,(if (featurep 'xemacs) "EFS" "Ange-FTP") ftp)
(const :tag "XEmacs" sep)))
(defconst tramp-prefix-format
(cond ((equal tramp-syntax 'ftp) "/")
((equal tramp-syntax 'sep) "/[")
((equal tramp-syntax 'url) "/")
(t (error "Wrong `tramp-syntax' defined")))
"String matching the very beginning of Tramp file names.
Used in `tramp-make-tramp-file-name'.")
......@@ -729,7 +724,6 @@ Should always start with \"^\". Derived from `tramp-prefix-format'.")
(defconst tramp-postfix-method-format
(cond ((equal tramp-syntax 'ftp) ":")
((equal tramp-syntax 'sep) "/")
((equal tramp-syntax 'url) "://")
(t (error "Wrong `tramp-syntax' defined")))
"String matching delimiter between method and user or host names.
Used in `tramp-make-tramp-file-name'.")
......@@ -776,7 +770,6 @@ Derived from `tramp-postfix-user-format'.")
(defconst tramp-prefix-ipv6-format
(cond ((equal tramp-syntax 'ftp) "[")
((equal tramp-syntax 'sep) "")
((equal tramp-syntax 'url) "[")
(t (error "Wrong `tramp-syntax' defined")))
"String matching left hand side of IPv6 addresses.
Used in `tramp-make-tramp-file-name'.")
......@@ -796,7 +789,6 @@ Derived from `tramp-prefix-ipv6-format'.")
(defconst tramp-postfix-ipv6-format
(cond ((equal tramp-syntax 'ftp) "]")
((equal tramp-syntax 'sep) "")
((equal tramp-syntax 'url) "]")
(t (error "Wrong `tramp-syntax' defined")))
"String matching right hand side of IPv6 addresses.
Used in `tramp-make-tramp-file-name'.")
......@@ -809,7 +801,6 @@ Derived from `tramp-postfix-ipv6-format'.")
(defconst tramp-prefix-port-format
(cond ((equal tramp-syntax 'ftp) "#")
((equal tramp-syntax 'sep) "#")
((equal tramp-syntax 'url) ":")
(t (error "Wrong `tramp-syntax' defined")))
"String matching delimiter between host names and port numbers.")
......@@ -838,7 +829,6 @@ Derived from `tramp-postfix-hop-format'.")
(defconst tramp-postfix-host-format
(cond ((equal tramp-syntax 'ftp) ":")
((equal tramp-syntax 'sep) "]")
((equal tramp-syntax 'url) "")
(t (error "Wrong `tramp-syntax' defined")))
"String matching delimiter between host names and localnames.
Used in `tramp-make-tramp-file-name'.")
......@@ -908,16 +898,10 @@ On W32 systems, the volume letter must be ignored.")
XEmacs uses a separate filename syntax for Tramp and EFS.
See `tramp-file-name-structure' for more explanations.")
;;;###autoload
(defconst tramp-file-name-regexp-url "\\`/[^/|:]+://"
"Value for `tramp-file-name-regexp' for URL-like remoting.
See `tramp-file-name-structure' for more explanations.")
;;;###autoload
(defconst tramp-file-name-regexp
(cond ((equal tramp-syntax 'ftp) tramp-file-name-regexp-unified)
((equal tramp-syntax 'sep) tramp-file-name-regexp-separate)
((equal tramp-syntax 'url) tramp-file-name-regexp-url)
(t (error "Wrong `tramp-syntax' defined")))
"Regular expression matching file names handled by Tramp.
This regexp should match Tramp file names but no other file names.
......@@ -951,17 +935,10 @@ On W32 systems, the volume letter must be ignored.")
XEmacs uses a separate filename syntax for Tramp and EFS.
See `tramp-file-name-structure' for more explanations.")
;;;###autoload
(defconst tramp-completion-file-name-regexp-url
"\\`/[^/:]+\\(:\\(/\\(/[^/]*\\)?\\)?\\)?\\'"
"Value for `tramp-completion-file-name-regexp' for URL-like remoting.
See `tramp-file-name-structure' for more explanations.")
;;;###autoload
(defconst tramp-completion-file-name-regexp
(cond ((equal tramp-syntax 'ftp) tramp-completion-file-name-regexp-unified)
((equal tramp-syntax 'sep) tramp-completion-file-name-regexp-separate)
((equal tramp-syntax 'url) tramp-completion-file-name-regexp-url)
(t (error "Wrong `tramp-syntax' defined")))
"Regular expression matching file names handled by Tramp completion.
This regexp should match partial Tramp file names only.
......@@ -2542,64 +2519,40 @@ They are collected by `tramp-completion-dissect-file-name1'."
tramp-prefix-ipv6-regexp
"\\(" tramp-completion-ipv6-regexp x-nil "\\)$")
nil 1 2 nil))
;; "/method:user" "/[method/user" "/method://user"
;; "/method:user" "/[method/user"
(tramp-completion-file-name-structure7
(list (concat tramp-prefix-regexp
"\\(" tramp-method-regexp "\\)" tramp-postfix-method-regexp
"\\(" tramp-user-regexp x-nil "\\)$")
1 2 nil nil))
;; "/method:host" "/[method/host" "/method://host"
;; "/method:host" "/[method/host"
(tramp-completion-file-name-structure8
(list (concat tramp-prefix-regexp
"\\(" tramp-method-regexp "\\)" tramp-postfix-method-regexp
"\\(" tramp-host-regexp x-nil "\\)$")
1 nil 2 nil))
;; "/method:[ipv6" "/[method/ipv6" "/method://[ipv6"
;; "/method:[ipv6" "/[method/ipv6"
(tramp-completion-file-name-structure9
(list (concat tramp-prefix-regexp
"\\(" tramp-method-regexp "\\)" tramp-postfix-method-regexp
tramp-prefix-ipv6-regexp
"\\(" tramp-completion-ipv6-regexp x-nil "\\)$")
1 nil 2 nil))
;; "/method:user@host" "/[method/user@host" "/method://user@host"
;; "/method:user@host" "/[method/user@host"
(tramp-completion-file-name-structure10
(list (concat tramp-prefix-regexp
"\\(" tramp-method-regexp "\\)" tramp-postfix-method-regexp
"\\(" tramp-user-regexp "\\)" tramp-postfix-user-regexp
"\\(" tramp-host-regexp x-nil "\\)$")
1 2 3 nil))
;; "/method:user@[ipv6" "/[method/user@ipv6" "/method://user@[ipv6"
;; "/method:user@[ipv6" "/[method/user@ipv6"
(tramp-completion-file-name-structure11
(list (concat tramp-prefix-regexp
"\\(" tramp-method-regexp "\\)" tramp-postfix-method-regexp
"\\(" tramp-user-regexp "\\)" tramp-postfix-user-regexp
tramp-prefix-ipv6-regexp
"\\(" tramp-completion-ipv6-regexp x-nil "\\)$")
1 2 3 nil))
;; "/method: "/method:/"
(tramp-completion-file-name-structure12
(list
(if (equal tramp-syntax 'url)
(concat tramp-prefix-regexp
"\\(" tramp-method-regexp "\\)"
"\\(" (substring tramp-postfix-method-regexp 0 1)
"\\|" (substring tramp-postfix-method-regexp 1 2) "\\)"
"\\(" "\\)$")
;; Should not match if not URL syntax.
(concat tramp-prefix-regexp "/$"))
1 3 nil nil))
;; "/method: "/method:/"
(tramp-completion-file-name-structure13
(list
(if (equal tramp-syntax 'url)
(concat tramp-prefix-regexp
"\\(" tramp-method-regexp "\\)"
"\\(" (substring tramp-postfix-method-regexp 0 1)
"\\|" (substring tramp-postfix-method-regexp 1 2) "\\)"
"\\(" "\\)$")
;; Should not match if not URL syntax.
(concat tramp-prefix-regexp "/$"))
1 nil 3 nil)))
1 2 3 nil)))
(mapc (lambda (structure)
(add-to-list 'result
......@@ -2616,8 +2569,6 @@ They are collected by `tramp-completion-dissect-file-name1'."
tramp-completion-file-name-structure9
tramp-completion-file-name-structure10
tramp-completion-file-name-structure11
tramp-completion-file-name-structure12
tramp-completion-file-name-structure13
tramp-file-name-structure))
(delq nil result)))
......@@ -3289,35 +3240,19 @@ User is always nil."
(defun tramp-handle-substitute-in-file-name (filename)
"Like `substitute-in-file-name' for Tramp files.
\"//\" and \"/~\" substitute only in the local filename part.
If the URL Tramp syntax is chosen, \"//\" as method delimiter and \"/~\" at
beginning of local filename are not substituted."
\"//\" and \"/~\" substitute only in the local filename part."
;; First, we must replace environment variables.
(setq filename (tramp-replace-environment-variables filename))
(with-parsed-tramp-file-name filename nil
(if (equal tramp-syntax 'url)
;; We need to check localname only. The other parts cannot contain
;; "//" or "/~".
(if (and (> (length localname) 1)
(or (string-match "//" localname)
(string-match "/~" localname 1)))
(tramp-run-real-handler 'substitute-in-file-name (list filename))
(tramp-make-tramp-file-name
(when method (substitute-in-file-name method))
(when user (substitute-in-file-name user))
(when host (substitute-in-file-name host))
(when localname
(tramp-run-real-handler
'substitute-in-file-name (list localname)))))
;; Ignore in LOCALNAME everything before "//" or "/~".
(when (and (stringp localname) (string-match ".+?/\\(/\\|~\\)" localname))
(setq filename
(concat (file-remote-p filename)
(replace-match "\\1" nil nil localname)))
;; "/m:h:~" does not work for completion. We use "/m:h:~/".
(when (string-match "~$" filename)
(setq filename (concat filename "/"))))
(tramp-run-real-handler 'substitute-in-file-name (list filename)))))
;; Ignore in LOCALNAME everything before "//" or "/~".
(when (and (stringp localname) (string-match ".+?/\\(/\\|~\\)" localname))
(setq filename
(concat (file-remote-p filename)
(replace-match "\\1" nil nil localname)))
;; "/m:h:~" does not work for completion. We use "/m:h:~/".
(when (string-match "~$" filename)
(setq filename (concat filename "/"))))
(tramp-run-real-handler 'substitute-in-file-name (list filename))))
(defun tramp-handle-unhandled-file-name-directory (_filename)
"Like `unhandled-file-name-directory' for Tramp files."
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment