Minor Tramp fixes

* lisp/net/tramp-sh.el (tramp-sh-handle-process-file): Set `env'
explicitly.
(tramp-barf-if-no-shell-prompt): Still add optional trailing
`ansi-color-control-seq-regexp'.

* lisp/net/tramp.el (tramp-make-tramp-file-name): Keep hop while
in file name completion.

* test/lisp/net/tramp-tests.el
(tramp-test26-interactive-file-name-completion): Adapt test.
This commit is contained in:
Michael Albinus 2023-05-27 10:14:50 +02:00
parent e77e986a9b
commit 4289044ccf
3 changed files with 11 additions and 8 deletions

View file

@ -3127,7 +3127,7 @@ implementation will be used."
(if (tramp-compat-string-search "=" elt)
(setq env (append env `(,elt)))
(setq uenv (cons elt uenv)))))
(setenv-internal env "INSIDE_EMACS" (tramp-inside-emacs) 'keep)
(setq env (setenv-internal env "INSIDE_EMACS" (tramp-inside-emacs) 'keep))
(when env
(setq command
(format
@ -4316,6 +4316,7 @@ seconds. If not, it produces an error message with the given ERROR-ARGS."
proc timeout
(rx
(| (regexp shell-prompt-pattern) (regexp tramp-shell-prompt-pattern))
(? (regexp ansi-color-control-seq-regexp))
eos))
(error
(delete-process proc)

View file

@ -1802,7 +1802,9 @@ the form (METHOD USER DOMAIN HOST PORT LOCALNAME &optional HOP)."
(when (cadr args)
(setq localname (and (stringp (cadr args)) (cadr args))))
(when hop
(setq hop nil)
;; Keep hop in file name for completion.
(unless minibuffer-completing-file-name
(setq hop nil))
;; Assure that the hops are in `tramp-default-proxies-alist'.
;; In tramp-archive.el, the slot `hop' is used for the archive
;; file name.
@ -5720,7 +5722,7 @@ See `tramp-process-actions' for the format of ACTIONS."
;; Obviously, the output was not complete.
(while (tramp-accept-process-output proc))
;; Remove ANSI control escape sequences.
(with-current-buffer (tramp-get-connection-buffer vec)
(with-current-buffer (tramp-get-connection-buffer vec)
(goto-char (point-min))
(while (re-search-forward ansi-color-control-seq-regexp nil t)
(replace-match "")))

View file

@ -4749,7 +4749,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
tramp-prefix-format hop
(substring-no-properties
method 0 (min 2 (length method))))
,(concat tramp-prefix-format method-string)
,(concat tramp-prefix-format hop method-string)
,method-string)))
;; Complete user name.
(unless (tramp-string-empty-or-nil-p user)
@ -4758,7 +4758,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
(substring-no-properties
user 0 (min 2 (length user))))
,(concat
tramp-prefix-format method-string user-string)
tramp-prefix-format hop method-string user-string)
,user-string)))
;; Complete host name.
(unless (tramp-string-empty-or-nil-p host)
@ -4768,9 +4768,9 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
(substring-no-properties
host 0 (min 2 (length host))))
(,(concat
tramp-prefix-format method-string host-string)
tramp-prefix-format hop method-string host-string)
,(concat
tramp-prefix-format method-string
tramp-prefix-format hop method-string
user-string host-string))
,host-string)))
;; Complete user and host name.
@ -4782,7 +4782,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
(substring-no-properties
host 0 (min 2 (length host))))
,(concat
tramp-prefix-format method-string
tramp-prefix-format hop method-string
user-string host-string)
,host-string)))))