aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus2017-10-21 18:51:25 +0200
committerMichael Albinus2017-10-21 18:51:25 +0200
commit0f286ca85a259575b67dba520ff72e59cc011426 (patch)
tree7b4baf7f5f6bd7cd515d3bbfd0fdb5042b590e80
parent888e51f2203c125e8283852d55e54acc8e893f8a (diff)
downloademacs-0f286ca85a259575b67dba520ff72e59cc011426.tar.gz
emacs-0f286ca85a259575b67dba520ff72e59cc011426.zip
Fix Bug#28889
* lisp/net/tramp.el: Change autoload cookie to tramp-autoload cookie. (tramp-completion-file-name-regexp-default) (tramp-completion-file-name-handler-alist) (tramp-completion-file-name-handler): Remove autoload cookie. (tramp-initial-completion-file-name-regexp): Remove. (tramp-autoload-file-name-regexp): New defconst. (tramp-register-autoload-file-name-handlers): Use it. (with-parsed-tramp-file-name): Adapt docstring. Compute `tramp-file-name' slots. (Bug#28889)
-rw-r--r--lisp/net/tramp.el51
1 files changed, 26 insertions, 25 deletions
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index c8b6e68f719..3d6934783f5 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -660,7 +660,7 @@ Useful for \"rsync\" like methods.")
660(make-variable-buffer-local 'tramp-temp-buffer-file-name) 660(make-variable-buffer-local 'tramp-temp-buffer-file-name)
661(put 'tramp-temp-buffer-file-name 'permanent-local t) 661(put 'tramp-temp-buffer-file-name 'permanent-local t)
662 662
663;;;###autoload 663;;;###tramp-autoload
664(defcustom tramp-syntax 'default 664(defcustom tramp-syntax 'default
665 "Tramp filename syntax to be used. 665 "Tramp filename syntax to be used.
666 666
@@ -978,7 +978,6 @@ This regexp should match Tramp file names but no other file
978names. When calling `tramp-register-file-name-handlers', the 978names. When calling `tramp-register-file-name-handlers', the
979initial value is overwritten by the car of `tramp-file-name-structure'.") 979initial value is overwritten by the car of `tramp-file-name-structure'.")
980 980
981;;;###autoload
982(defconst tramp-completion-file-name-regexp-default 981(defconst tramp-completion-file-name-regexp-default
983 (concat 982 (concat
984 "\\`/\\(" 983 "\\`/\\("
@@ -1042,10 +1041,19 @@ updated after changing this variable.
1042Also see `tramp-file-name-structure'.") 1041Also see `tramp-file-name-structure'.")
1043 1042
1044;;;###autoload 1043;;;###autoload
1045(defconst tramp-initial-completion-file-name-regexp 1044(defconst tramp-autoload-file-name-regexp
1046 tramp-completion-file-name-regexp-default 1045 (concat
1047 "Value for `tramp-completion-file-name-regexp' for autoload. 1046 "\\`/"
1048It must match the initial `tramp-syntax' settings.") 1047 (if (memq system-type '(cygwin windows-nt))
1048 ;; The method is either "-", or at least two characters.
1049 "\\(-\\|[^/|:]\\{2,\\}\\)"
1050 ;; At least one character for method.
1051 "[^/|:]+")
1052 ":\\'")
1053 "Regular expression matching file names handled by Tramp autoload.
1054It must match the initial `tramp-syntax' settings. It should not
1055match file names at root of the underlying local file system,
1056like \"/sys\" or \"/C:\".")
1049 1057
1050;; Chunked sending kludge. We set this to 500 for black-listed constellations 1058;; Chunked sending kludge. We set this to 500 for black-listed constellations
1051;; known to have a bug in `process-send-string'; some ssh connections appear 1059;; known to have a bug in `process-send-string'; some ssh connections appear
@@ -1186,7 +1194,6 @@ means to use always cached values for the directory contents."
1186(defvar tramp-current-connection nil 1194(defvar tramp-current-connection nil
1187 "Last connection timestamp.") 1195 "Last connection timestamp.")
1188 1196
1189;;;###autoload
1190(defconst tramp-completion-file-name-handler-alist 1197(defconst tramp-completion-file-name-handler-alist
1191 '((file-name-all-completions 1198 '((file-name-all-completions
1192 . tramp-completion-handle-file-name-all-completions) 1199 . tramp-completion-handle-file-name-all-completions)
@@ -1740,20 +1747,22 @@ Second arg VAR is a symbol. It is used as a variable name to hold
1740the filename structure. It is also used as a prefix for the variables 1747the filename structure. It is also used as a prefix for the variables
1741holding the components. For example, if VAR is the symbol `foo', then 1748holding the components. For example, if VAR is the symbol `foo', then
1742`foo' will be bound to the whole structure, `foo-method' will be bound to 1749`foo' will be bound to the whole structure, `foo-method' will be bound to
1743the method component, and so on for `foo-user', `foo-host', `foo-localname', 1750the method component, and so on for `foo-user', `foo-domain', `foo-host',
1744`foo-hop'. 1751`foo-port', `foo-localname', `foo-hop'.
1745 1752
1746Remaining args are Lisp expressions to be evaluated (inside an implicit 1753Remaining args are Lisp expressions to be evaluated (inside an implicit
1747`progn'). 1754`progn').
1748 1755
1749If VAR is nil, then we bind `v' to the structure and `method', `user', 1756If VAR is nil, then we bind `v' to the structure and `method', `user',
1750`host', `localname', `hop' to the components." 1757`domain', `host', `port', `localname', `hop' to the components."
1751 (let ((bindings 1758 (let ((bindings
1752 (mapcar (lambda (elem) 1759 (mapcar (lambda (elem)
1753 `(,(if var (intern (format "%s-%s" var elem)) elem) 1760 `(,(if var (intern (format "%s-%s" var elem)) elem)
1754 (,(intern (format "tramp-file-name-%s" elem)) 1761 (,(intern (format "tramp-file-name-%s" elem))
1755 ,(or var 'v)))) 1762 ,(or var 'v))))
1756 '(method user domain host port localname hop)))) 1763 (eval-and-compile
1764 (cdr
1765 (mapcar 'car (cl-struct-slot-info 'tramp-file-name)))))))
1757 `(let* ((,(or var 'v) (tramp-dissect-file-name ,filename)) 1766 `(let* ((,(or var 'v) (tramp-dissect-file-name ,filename))
1758 ,@bindings) 1767 ,@bindings)
1759 ;; We don't know which of those vars will be used, so we bind them all, 1768 ;; We don't know which of those vars will be used, so we bind them all,
@@ -2281,7 +2290,6 @@ Falls back to normal file name handler if no Tramp file name handler exists."
2281 ;; we don't do anything. 2290 ;; we don't do anything.
2282 (tramp-run-real-handler operation args)))) 2291 (tramp-run-real-handler operation args))))
2283 2292
2284;;;###autoload
2285(defun tramp-completion-file-name-handler (operation &rest args) 2293(defun tramp-completion-file-name-handler (operation &rest args)
2286 "Invoke Tramp file name completion handler. 2294 "Invoke Tramp file name completion handler.
2287Falls back to normal file name handler if no Tramp file name handler exists." 2295Falls back to normal file name handler if no Tramp file name handler exists."
@@ -2304,17 +2312,9 @@ Falls back to normal file name handler if no Tramp file name handler exists."
2304(progn (defun tramp-register-autoload-file-name-handlers () 2312(progn (defun tramp-register-autoload-file-name-handlers ()
2305 "Add Tramp file name handlers to `file-name-handler-alist' during autoload." 2313 "Add Tramp file name handlers to `file-name-handler-alist' during autoload."
2306 (add-to-list 'file-name-handler-alist 2314 (add-to-list 'file-name-handler-alist
2307 (cons tramp-initial-file-name-regexp 2315 (cons tramp-autoload-file-name-regexp
2308 'tramp-autoload-file-name-handler)) 2316 'tramp-autoload-file-name-handler))
2309 (put 'tramp-autoload-file-name-handler 'safe-magic t) 2317 (put 'tramp-autoload-file-name-handler 'safe-magic t)))
2310
2311 (add-to-list 'file-name-handler-alist
2312 (cons tramp-initial-completion-file-name-regexp
2313 'tramp-completion-file-name-handler))
2314 (put 'tramp-completion-file-name-handler 'safe-magic t)
2315 ;; Mark `operations' the handler is responsible for.
2316 (put 'tramp-completion-file-name-handler 'operations
2317 (mapcar 'car tramp-completion-file-name-handler-alist))))
2318 2318
2319;;;###autoload 2319;;;###autoload
2320(tramp-register-autoload-file-name-handlers) 2320(tramp-register-autoload-file-name-handlers)
@@ -2455,7 +2455,8 @@ not in completion mode."
2455 2455
2456;; Method, host name and user name completion. 2456;; Method, host name and user name completion.
2457;; `tramp-completion-dissect-file-name' returns a list of 2457;; `tramp-completion-dissect-file-name' returns a list of
2458;; tramp-file-name structures. For all of them we return possible completions. 2458;; `tramp-file-name' structures. For all of them we return possible
2459;; completions.
2459(defun tramp-completion-handle-file-name-all-completions (filename directory) 2460(defun tramp-completion-handle-file-name-all-completions (filename directory)
2460 "Like `file-name-all-completions' for partial Tramp files." 2461 "Like `file-name-all-completions' for partial Tramp files."
2461 2462
@@ -2536,9 +2537,9 @@ not in completion mode."
2536 (tramp-connectable-p (expand-file-name filename directory))) 2537 (tramp-connectable-p (expand-file-name filename directory)))
2537 (lambda (x) (funcall predicate (expand-file-name (car x) directory)))))) 2538 (lambda (x) (funcall predicate (expand-file-name (car x) directory))))))
2538 2539
2539;; I misuse a little bit the tramp-file-name structure in order to 2540;; I misuse a little bit the `tramp-file-name' structure in order to
2540;; handle completion possibilities for partial methods / user names / 2541;; handle completion possibilities for partial methods / user names /
2541;; host names. Return value is a list of tramp-file-name structures 2542;; host names. Return value is a list of `tramp-file-name' structures
2542;; according to possible completions. If "localname" is non-nil it 2543;; according to possible completions. If "localname" is non-nil it
2543;; means there shouldn't be a completion anymore. 2544;; means there shouldn't be a completion anymore.
2544 2545