summaryrefslogtreecommitdiff
path: root/lisp/net
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/net')
-rw-r--r--lisp/net/ange-ftp.el4
-rw-r--r--lisp/net/tramp-adb.el20
-rw-r--r--lisp/net/tramp-integration.el34
-rw-r--r--lisp/net/tramp-sh.el1
4 files changed, 56 insertions, 3 deletions
diff --git a/lisp/net/ange-ftp.el b/lisp/net/ange-ftp.el
index 428bf32947b..5af9ea75ed1 100644
--- a/lisp/net/ange-ftp.el
+++ b/lisp/net/ange-ftp.el
@@ -4277,7 +4277,7 @@ NEWNAME should be the name to give the new compressed or uncompressed file.")
nil
t
nil
- "-c"
+ shell-command-switch
(format "compress -f -c < %s > %s" tmp1 tmp2))
(and ange-ftp-process-verbose
(ange-ftp-message "Compressing %s...done" abbr))
@@ -4313,7 +4313,7 @@ NEWNAME should be the name to give the new compressed or uncompressed file.")
nil
t
nil
- "-c"
+ shell-command-switch
(format "uncompress -c < %s > %s" tmp1 tmp2))
(and ange-ftp-process-verbose
(ange-ftp-message "Uncompressing %s...done" abbr))
diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el
index eb3295ee352..b40e69ef634 100644
--- a/lisp/net/tramp-adb.el
+++ b/lisp/net/tramp-adb.el
@@ -1370,6 +1370,26 @@ connection if a previous connection has died for some reason."
;; Mark it as connected.
(tramp-set-connection-property p "connected" t)))))))
+;; Default settings for connection-local variables.
+(defconst tramp-adb-connection-local-default-profile
+ '((shell-file-name . "/system/bin/sh")
+ (shell-command-switch . "-c"))
+ "Default connection-local variables for remote adb connections.")
+(add-to-list 'tramp-connection-local-safe-shell-file-names "/system/bin/sh")
+
+;; `connection-local-set-profile-variables' and
+;; `connection-local-set-profiles' exists since Emacs 26.1.
+(eval-after-load "shell"
+ '(progn
+ (tramp-compat-funcall
+ 'connection-local-set-profile-variables
+ 'tramp-adb-connection-local-default-profile
+ tramp-adb-connection-local-default-profile)
+ (tramp-compat-funcall
+ 'connection-local-set-profiles
+ `(:application tramp :protocol ,tramp-adb-method)
+ 'tramp-adb-connection-local-default-profile)))
+
(add-hook 'tramp-unload-hook
(lambda ()
(unload-feature 'tramp-adb 'force)))
diff --git a/lisp/net/tramp-integration.el b/lisp/net/tramp-integration.el
index 2a461763480..946d7f8cbab 100644
--- a/lisp/net/tramp-integration.el
+++ b/lisp/net/tramp-integration.el
@@ -27,9 +27,10 @@
;;; Code:
+(require 'tramp-compat)
+
;; Pacify byte-compiler.
(require 'cl-lib)
-(declare-function tramp-compat-exec-path "tramp")
(declare-function tramp-dissect-file-name "tramp")
(declare-function tramp-file-name-equal-p "tramp")
(declare-function tramp-tramp-file-p "tramp")
@@ -170,6 +171,37 @@ NAME must be equal to `tramp-current-connection'."
(remove-hook 'tramp-cleanup-all-connections-hook
#'tramp-recentf-cleanup-all)))))
+;;; Default connection-local variables for Tramp:
+
+;;;###tramp-autoload
+(defvar tramp-connection-local-safe-shell-file-names nil
+ "List of safe `shell-file-name' values for remote hosts.")
+(add-to-list 'tramp-connection-local-safe-shell-file-names "/bin/sh")
+
+(defconst tramp-connection-local-default-profile
+ '((shell-file-name . "/bin/sh")
+ (shell-command-switch . "-c"))
+ "Default connection-local variables for remote connections.")
+(put 'shell-file-name 'safe-local-variable
+ (lambda (item)
+ (and (stringp item)
+ (member item tramp-connection-local-safe-shell-file-names))))
+(put 'shell-command-switch 'safe-local-variable
+ (lambda (item) (and (stringp item) (string-equal item "-c"))))
+
+;; `connection-local-set-profile-variables' and
+;; `connection-local-set-profiles' exists since Emacs 26.1.
+(eval-after-load "shell"
+ '(progn
+ (tramp-compat-funcall
+ 'connection-local-set-profile-variables
+ 'tramp-connection-local-default-profile
+ tramp-connection-local-default-profile)
+ (tramp-compat-funcall
+ 'connection-local-set-profiles
+ `(:application tramp)
+ 'tramp-connection-local-default-profile)))
+
(add-hook 'tramp-unload-hook
(lambda () (unload-feature 'tramp-integration 'force)))
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index ee16138f700..d9edcb14198 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -81,6 +81,7 @@ the default storage location, e.g. \"$HOME/.sh_history\"."
(const :tag "Unset HISTFILE" t)
(string :tag "Redirect to a file")))
+;;;###tramp-autoload
(defconst tramp-display-escape-sequence-regexp "\e[[;0-9]+m"
"Terminal control escape sequences for display attributes.")