aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/net
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/net')
-rw-r--r--lisp/net/tramp-sh.el16
-rw-r--r--lisp/net/tramp.el21
2 files changed, 28 insertions, 9 deletions
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 953ca54ffda..c83a7a9978d 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -4693,7 +4693,21 @@ process to set up. VEC specifies the connection."
4693 t)) 4693 t))
4694 (when unset 4694 (when unset
4695 (tramp-send-command 4695 (tramp-send-command
4696 vec (format "unset %s" (string-join unset " ")) t))))) 4696 vec (format "unset %s" (string-join unset " ")) t)))
4697
4698 ;; Set connection-local variable `command-line-max-length'.
4699 ;; `command-line-max-length' exists since Emacs 31.
4700 ;; `connection-local-profile-name-for-criteria' exists since Emacs 29.1.
4701 ;; We simulate it with `make-symbol'.
4702 (when (boundp 'command-line-max-length)
4703 (let* ((criteria (tramp-get-connection-local-criteria vec))
4704 (profile (if (fboundp 'connection-local-profile-name-for-criteria)
4705 (connection-local-profile-name-for-criteria criteria)
4706 (make-symbol "generated-profile-name"))))
4707 (connection-local-set-profile-variables
4708 profile
4709 `((command-line-max-length . ,(tramp-get-remote-pipe-buf vec))))
4710 (connection-local-set-profiles criteria profile)))))
4697 4711
4698;; Old text from documentation of tramp-methods: 4712;; Old text from documentation of tramp-methods:
4699;; Using a uuencode/uudecode inline method is discouraged, please use one 4713;; Using a uuencode/uudecode inline method is discouraged, please use one
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 475392b68d8..5441a26d7a0 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -2097,16 +2097,24 @@ In case a second asynchronous communication has been started, it is different
2097from the default one." 2097from the default one."
2098 (and (tramp-file-name-p vec) (get-process (tramp-get-connection-name vec)))) 2098 (and (tramp-file-name-p vec) (get-process (tramp-get-connection-name vec))))
2099 2099
2100(defsubst tramp-get-connection-local-criteria (vec)
2101 "Get connection-local criteria for VEC."
2102 (append
2103 '(:application tramp)
2104 (when (tramp-file-name-method vec)
2105 `(:protocol ,(substring-no-properties (tramp-file-name-method vec))))
2106 (when (tramp-file-name-user-domain vec)
2107 `(:user ,(substring-no-properties (tramp-file-name-user-domain vec))))
2108 (when (tramp-file-name-host-port vec)
2109 `(:machine ,(substring-no-properties (tramp-file-name-host-port vec))))))
2110
2100(defun tramp-set-connection-local-variables (vec) 2111(defun tramp-set-connection-local-variables (vec)
2101 "Set connection-local variables in the connection buffer used for VEC. 2112 "Set connection-local variables in the connection buffer used for VEC.
2102If connection-local variables are not supported by this Emacs 2113If connection-local variables are not supported by this Emacs
2103version, the function does nothing." 2114version, the function does nothing."
2104 (with-current-buffer (tramp-get-connection-buffer vec) 2115 (with-current-buffer (tramp-get-connection-buffer vec)
2105 (hack-connection-local-variables-apply 2116 (hack-connection-local-variables-apply
2106 `(:application tramp 2117 (tramp-get-connection-local-criteria vec))))
2107 :protocol ,(tramp-file-name-method vec)
2108 :user ,(tramp-file-name-user-domain vec)
2109 :machine ,(tramp-file-name-host-port vec)))))
2110 2118
2111(defun tramp-set-connection-local-variables-for-buffer () 2119(defun tramp-set-connection-local-variables-for-buffer ()
2112 "Set connection-local variables in the current buffer. 2120 "Set connection-local variables in the current buffer.
@@ -2114,10 +2122,7 @@ If connection-local variables are not supported by this Emacs
2114version, the function does nothing." 2122version, the function does nothing."
2115 (when (tramp-tramp-file-p default-directory) 2123 (when (tramp-tramp-file-p default-directory)
2116 (hack-connection-local-variables-apply 2124 (hack-connection-local-variables-apply
2117 `(:application tramp 2125 (connection-local-criteria-for-default-directory))))
2118 :protocol ,(file-remote-p default-directory 'method)
2119 :user ,(file-remote-p default-directory 'user)
2120 :machine ,(file-remote-p default-directory 'host)))))
2121 2126
2122(defsubst tramp-get-default-directory (buffer) 2127(defsubst tramp-get-default-directory (buffer)
2123 "Return `default-directory' of BUFFER." 2128 "Return `default-directory' of BUFFER."