Skip to content

Commit 69061fd

Browse files
committed
Add new Tramp syntax
* lisp/net/tramp-cmds.el (tramp-change-syntax): New defun. * lisp/net/tramp.el (tramp-syntax): Change default to `def'. Add :set function. (tramp-prefix-port-format): Simplify. (tramp-file-name-regexp-separate): Remove. (tramp-initial-file-name-regexp) (tramp-completion-file-name-regexp-old-style) (tramp-initial-completion-file-name-regexp): New defconst. (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) (tramp-rfn-eshadow-update-overlay-regexp): Change them to be defuns. (tramp-tramp-file-p, tramp-find-method) (tramp-dissect-file-name, tramp-make-tramp-file-name) (tramp-completion-make-tramp-file-name) (tramp-rfn-eshadow-update-overlay) (tramp-register-autoload-file-name-handlers) (tramp-register-file-name-handlers) (tramp-unload-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 them.
1 parent c1fa072 commit 69061fd

File tree

4 files changed

+218
-178
lines changed

4 files changed

+218
-178
lines changed

lisp/net/tramp-cmds.el

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,20 @@
3737
(defvar reporter-eval-buffer)
3838
(defvar reporter-prompt-for-summary-p)
3939

40+
;;;###autoload
41+
(defun tramp-change-syntax (&optional syntax)
42+
"Change Tramp syntax.
43+
SYNTAX can be one of the symbols `def' (default), `ftp' (ange-ftp like)
44+
or `sep' (XEmacs like)."
45+
(interactive
46+
(let ((input (completing-read
47+
"Enter Tramp syntax: " '(def ftp sep) nil t
48+
(symbol-name tramp-syntax))))
49+
(unless (string-equal input "")
50+
(list (intern input)))))
51+
(when syntax
52+
(custom-set-variables `(tramp-syntax ',syntax))))
53+
4054
(defun tramp-list-tramp-buffers ()
4155
"Return a list of all Tramp connection buffers."
4256
(append

lisp/net/tramp-ftp.el

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,10 @@ pass to the OPERATION."
122122
(or (boundp 'ange-ftp-name-format)
123123
(let (file-name-handler-alist) (require 'ange-ftp)))
124124
(let ((ange-ftp-name-format
125-
(list (nth 0 tramp-file-name-structure)
126-
(nth 3 tramp-file-name-structure)
127-
(nth 2 tramp-file-name-structure)
128-
(nth 4 tramp-file-name-structure)))
125+
(list (nth 0 (tramp-file-name-structure))
126+
(nth 3 (tramp-file-name-structure))
127+
(nth 2 (tramp-file-name-structure))
128+
(nth 4 (tramp-file-name-structure))))
129129
;; ange-ftp uses `ange-ftp-ftp-name-arg' and `ange-ftp-ftp-name-res'
130130
;; for optimization in `ange-ftp-ftp-name'. If Tramp wasn't active,
131131
;; there could be incorrect values from previous calls in case the

lisp/net/tramp-sh.el

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3445,7 +3445,7 @@ the result will be a local, non-Tramp, file name."
34453445
(let (tramp-vc-registered-file-names
34463446
(remote-file-name-inhibit-cache (current-time))
34473447
(file-name-handler-alist
3448-
`((,tramp-file-name-regexp . tramp-vc-file-name-handler))))
3448+
`((,(tramp-file-name-regexp) . tramp-vc-file-name-handler))))
34493449

34503450
;; Here we collect only file names, which need an operation.
34513451
(ignore-errors (tramp-run-real-handler 'vc-registered (list file)))
@@ -4482,7 +4482,7 @@ Goes through the list `tramp-inline-compress-commands'."
44824482
(let ((user (tramp-file-name-user item))
44834483
(host (tramp-file-name-host item))
44844484
(proxy (concat
4485-
tramp-prefix-format proxy tramp-postfix-host-format)))
4485+
(tramp-prefix-format) proxy (tramp-postfix-host-format))))
44864486
(tramp-message
44874487
vec 5 "Add proxy (\"%s\" \"%s\" \"%s\")"
44884488
(and (stringp host) (regexp-quote host))

0 commit comments

Comments
 (0)