Commit ed33337c authored by Michael Albinus's avatar Michael Albinus

Require method in remote file name syntax

* lisp/minibuffer.el (completion--nth-completion):
Do not bind `non-essential'.

* lisp/net/tramp-adb.el (tramp-adb-maybe-open-connection):
* lisp/net/tramp-gvfs.el (tramp-gvfs-maybe-open-connection):
* lisp/net/tramp-sh.el (tramp-maybe-open-connection):
* lisp/net/tramp-smb.el (tramp-smb-maybe-open-connection): Do not call
`tramp-check-proper-method-and-host'.

* lisp/net/tramp-sh.el (tramp-ssh-controlmaster-options): Better traces.
(tramp-maybe-open-connection): Do not use argument for
´tramp-completion-mode-p'.

* lisp/net/tramp.el (tramp-default-method-marker): New defconst.
(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):
Use `eq' instead of `eqal'.
(tramp-method-regexp, tramp-domain-regexp)
(tramp-remote-file-name-spec-regexp)
(tramp-file-name-regexp-unified)
(tramp-completion-file-name-regexp-unified)
(tramp-completion-file-name-regexp-separate): Adapt regexp.
(tramp-completion-file-name-handler-alist)
(tramp-run-real-handler): Autoload them.
(tramp-find-method): Handle `tramp-default-method-marker'.
(tramp-check-proper-method-and-host)
(tramp-completion-run-real-handler): Remove them.
(tramp-error-with-buffer, tramp-connectable-p): Do not use
argument for ´tramp-completion-mode-p'.
(tramp-find-foreign-file-name-handler): Remove COMPLETION
argument.  Do not apply heuristic for completion.
(tramp-file-name-handler): Do not modify `non-essential'.
(tramp-completion-file-name-handler): Change implementation.
(tramp-autoload-file-name-handler)
(tramp-completion-handle-file-name-all-completions):
Call `tramp-run-real-handler'.
(tramp-completion-mode-p): Do not autoload.  Remove argument.
Do not apply heuristic for completion.
(tramp-completion-dissect-file-name): Simplify implementation.
(tramp-handle-file-name-as-directory): Call `tramp-connectable-p'.

* test/lisp/net/tramp-tests.el (tramp-test01-file-name-syntax)
(tramp-test02-file-name-dissect)
(tramp-test03-file-name-defaults)
(tramp-test06-directory-file-name): Adapt to the new syntax.
(tramp-test11-copy-file, tramp-test12-rename-file)
(tramp--test-check-files): Deactivate temporarily tests with
quoted file names.
(tramp-test16-directory-files, tramp-test17-insert-directory):
Adapt tests.
(tramp-test24-file-name-completion): Do not check for
completion mode.
(tramp-test31-make-auto-save-file-name): Deactivate temporarily
two tests.
parent f591765e
......@@ -894,22 +894,21 @@ This overrides the defaults specified in `completion-category-defaults'."
;; The quote/unquote function needs to come from the completion table (rather
;; than from completion-extra-properties) because it may apply only to some
;; part of the string (e.g. substitute-in-file-name).
(let* ((requote
(when (completion-metadata-get metadata 'completion--unquote-requote)
(cl-assert (functionp table))
(let ((new (funcall table string point 'completion--unquote)))
(setq string (pop new))
(setq table (pop new))
(setq point (pop new))
(cl-assert (<= point (length string)))
(pop new))))
(non-essential t)
(result
(completion--some (lambda (style)
(funcall (nth n (assq style
completion-styles-alist))
string table pred point))
(completion--styles metadata))))
(let ((requote
(when (completion-metadata-get metadata 'completion--unquote-requote)
(cl-assert (functionp table))
(let ((new (funcall table string point 'completion--unquote)))
(setq string (pop new))
(setq table (pop new))
(setq point (pop new))
(cl-assert (<= point (length string)))
(pop new))))
(result
(completion--some (lambda (style)
(funcall (nth n (assq style
completion-styles-alist))
string table pred point))
(completion--styles metadata))))
(if requote
(funcall requote result n)
result)))
......
......@@ -1191,8 +1191,6 @@ FMT and ARGS are passed to `error'."
"Maybe open a connection VEC.
Does not do anything if a connection is already open, but re-opens the
connection if a previous connection has died for some reason."
(tramp-check-proper-method-and-host vec)
(let* ((buf (tramp-get-connection-buffer vec))
(p (get-buffer-process buf))
(host (tramp-file-name-host vec))
......
......@@ -4,6 +4,7 @@
;; Author: Daniel Pittman <daniel@inanna.danann.net>
;; Michael Albinus <michael.albinus@gmx.de>
;; Maintainer: Michael Albinus <michael.albinus@gmx.de>
;; Keywords: comm, processes
;; Package: tramp
......
......@@ -1626,8 +1626,6 @@ ID-FORMAT valid values are `string' and `integer'."
"Maybe open a connection VEC.
Does not do anything if a connection is already open, but re-opens the
connection if a previous connection has died for some reason."
(tramp-check-proper-method-and-host vec)
;; We set the file name, in case there are incoming D-Bus signals or
;; D-Bus errors.
(setq tramp-gvfs-dbus-event-vector vec)
......
......@@ -6,6 +6,7 @@
;; Author: Kai Großjohann <kai.grossjohann@gmx.net>
;; Michael Albinus <michael.albinus@gmx.de>
;; Maintainer: Michael Albinus <michael.albinus@gmx.de>
;; Keywords: comm, processes
;; Package: tramp
......@@ -4576,38 +4577,39 @@ Goes through the list `tramp-inline-compress-commands'."
(let ((case-fold-search t))
(ignore-errors
(when (executable-find "ssh")
(with-temp-buffer
(tramp-call-process vec "ssh" nil t nil "-o" "ControlMaster")
(goto-char (point-min))
(when (search-forward-regexp "missing.+argument" nil t)
(setq tramp-ssh-controlmaster-options "-o ControlMaster=auto")))
(unless (zerop (length tramp-ssh-controlmaster-options))
(with-temp-buffer
;; We use a non-existing IP address, in order to avoid
;; useless connections, and DNS timeouts.
(tramp-call-process
vec "ssh" nil t nil "-o" "ControlPath=%C" "0.0.0.1")
(goto-char (point-min))
(setq tramp-ssh-controlmaster-options
(concat tramp-ssh-controlmaster-options
(if (search-forward-regexp "unknown.+key" nil t)
" -o ControlPath='tramp.%%r@%%h:%%p'"
" -o ControlPath='tramp.%%C'"))))
(with-tramp-progress-reporter
vec 4 "Computing ControlMaster options"
(with-temp-buffer
(tramp-call-process vec "ssh" nil t nil "-o" "ControlPersist")
(tramp-call-process vec "ssh" nil t nil "-o" "ControlMaster")
(goto-char (point-min))
(when (search-forward-regexp "missing.+argument" nil t)
(setq tramp-ssh-controlmaster-options
"-o ControlMaster=auto")))
(unless (zerop (length tramp-ssh-controlmaster-options))
(with-temp-buffer
;; We use a non-existing IP address, in order to
;; avoid useless connections, and DNS timeouts.
(tramp-call-process
vec "ssh" nil t nil "-o" "ControlPath=%C" "0.0.0.1")
(goto-char (point-min))
(setq tramp-ssh-controlmaster-options
(concat tramp-ssh-controlmaster-options
" -o ControlPersist=no"))))))))
(if (search-forward-regexp "unknown.+key" nil t)
" -o ControlPath='tramp.%%r@%%h:%%p'"
" -o ControlPath='tramp.%%C'"))))
(with-temp-buffer
(tramp-call-process vec "ssh" nil t nil "-o" "ControlPersist")
(goto-char (point-min))
(when (search-forward-regexp "missing.+argument" nil t)
(setq tramp-ssh-controlmaster-options
(concat tramp-ssh-controlmaster-options
" -o ControlPersist=no")))))))))
tramp-ssh-controlmaster-options)))
(defun tramp-maybe-open-connection (vec)
"Maybe open a connection VEC.
Does not do anything if a connection is already open, but re-opens the
connection if a previous connection has died for some reason."
(tramp-check-proper-method-and-host vec)
(let ((p (tramp-get-connection-process vec))
(process-name (tramp-get-connection-property vec "process-name" nil))
(process-environment (copy-sequence process-environment))
......@@ -4654,7 +4656,7 @@ connection if a previous connection has died for some reason."
;; check this for the process related to
;; `tramp-buffer-name'; otherwise `start-file-process'
;; wouldn't run ever when `non-essential' is non-nil.
(when (and (tramp-completion-mode-p vec)
(when (and (tramp-completion-mode-p)
(null (get-process (tramp-buffer-name vec))))
(throw 'non-essential 'non-essential))
......
......@@ -1781,8 +1781,6 @@ Does not do anything if a connection is already open, but re-opens the
connection if a previous connection has died for some reason.
If ARGUMENT is non-nil, use it as argument for
`tramp-smb-winexe-program', and suppress any checks."
(tramp-check-proper-method-and-host vec)
(let* ((share (tramp-smb-get-share vec))
(buf (tramp-get-connection-buffer vec))
(p (get-buffer-process buf)))
......
......@@ -3,6 +3,7 @@
;; Copyright (C) 2002-2017 Free Software Foundation, Inc.
;; Author: Kai Großjohann <kai.grossjohann@gmx.net>
;; Maintainer: Michael Albinus <michael.albinus@gmx.de>
;; Keywords: comm, terminals
;; Package: tramp
......
This diff is collapsed.
......@@ -4,6 +4,7 @@
;; Copyright (C) 2003-2017 Free Software Foundation, Inc.
;; Author: Kai Großjohann <kai.grossjohann@gmx.net>
;; Maintainer: Michael Albinus <michael.albinus@gmx.de>
;; Keywords: comm, processes
;; Package: tramp
;; Version: 2.3.2-pre
......
This diff is collapsed.
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