diff options
| author | Michael Albinus | 2019-03-09 16:44:24 +0100 |
|---|---|---|
| committer | Michael Albinus | 2019-03-09 16:44:24 +0100 |
| commit | 21f54feee8c83e2c5fd8eeb6741cbd479a7b19eb (patch) | |
| tree | 3edf223c49dfedf09ec93804856954a9554a93cd /doc | |
| parent | c37bdd00c7dcabaa3ca8405d9dc5122ed36f27e0 (diff) | |
| download | emacs-21f54feee8c83e2c5fd8eeb6741cbd479a7b19eb.tar.gz emacs-21f54feee8c83e2c5fd8eeb6741cbd479a7b19eb.zip | |
Do not hardcode "/bin/sh" in compile. Bug#24338, Bug#29723
* doc/emacs/custom.texi (Connection Variables): New node.
* doc/emacs/emacs.texi (Top): Add entry for Connection Variables.
* doc/emacs/misc.texi (Single Shell): Mention default value for
remote buffers.
* doc/lispref/variables.texi (Connection Local Variables):
Describe `with-connection-local-variables' instead of
`with-connection-local-profiles'.
* doc/misc/tramp.texi (Remote processes): Refer to Emacs manual.
Mention default connection-local settings for `shell-file-name'
and `shell-command-switch'.
* etc/NEWS: Mention connection-local variables changes.
* lisp/files-x.el (hack-connection-local-variables):
Push connection-local variables to `file-local-variables-alist'.
(connection-local-criteria-for-default-directory): New defsubst.
(with-connection-local-variables): Rename from
`with-connection-local-profiles'. Adapt implementation.
* lisp/files.el (hack-local-variables):
Call `hack-connection-local-variables'.
* lisp/shell.el (shell): Use `with-connection-local-variables'.
* lisp/subr.el (start-file-process-shell-command):
* lisp/progmodes/compile.el (compilation-start):
Use `with-connection-local-variables'. Do not set "/bin/sh" for
remote buffers, trust settings of `shell-file-name'. (Bug#24338),
(Bug#29723)
* lisp/net/ange-ftp.el (ange-ftp-compress, ange-ftp-uncompress):
Use `shell-command-switch'.
* lisp/net/tramp-adb.el (tramp-adb-connection-local-default-profile):
New defvar. Add it to connection-local profiles after loading "shell".
* lisp/net/tramp-integration.el (tramp-compat): Require tramp-compat.
(tramp-compat-exec-path): Do not declare anymore.
(tramp-connection-local-safe-shell-file-names): New defvar.
(tramp-connection-local-default-profile): New defconst. Activate
it after loading "shell".
(shell-file-name, shell-command-switch): Add safe-local-variable
property.
* lisp/net/tramp-sh.el (tramp-display-escape-sequence-regexp):
Add tramp-autoload cookie.
* test/lisp/files-x-tests.el (remote-shell-file-name):
Add safe-local-variable property to remote-* variables.
(tramp-connection-local-default-profile): Declare.
(files-x-test-with-connection-local-variables):
Rename from `files-x-test-with-connection-local-profiles'. Adapt
implementation.
* test/lisp/net/tramp-tests.el
(tramp-test34-connection-local-variables): New test.
(tramp-test34-explicit-shell-file-name): Run it also for tramp-adb.
Bind connection-local-{profile,criteria}-alist. Use tramp-adb
specific `shell-file-name'. Add safe-local-variable property to
`explicit-shell-file-name' and `explicit-sh-args'.
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/emacs/custom.texi | 48 | ||||
| -rw-r--r-- | doc/emacs/emacs.texi | 2 | ||||
| -rw-r--r-- | doc/emacs/misc.texi | 4 | ||||
| -rw-r--r-- | doc/lispref/variables.texi | 17 | ||||
| -rw-r--r-- | doc/misc/tramp.texi | 10 |
5 files changed, 75 insertions, 6 deletions
diff --git a/doc/emacs/custom.texi b/doc/emacs/custom.texi index 474149fcae6..c649c170293 100644 --- a/doc/emacs/custom.texi +++ b/doc/emacs/custom.texi | |||
| @@ -765,6 +765,8 @@ expects (@pxref{Examining}). | |||
| 765 | * Locals:: Per-buffer values of variables. | 765 | * Locals:: Per-buffer values of variables. |
| 766 | * File Variables:: How files can specify variable values. | 766 | * File Variables:: How files can specify variable values. |
| 767 | * Directory Variables:: How variable values can be specified by directory. | 767 | * Directory Variables:: How variable values can be specified by directory. |
| 768 | * Connection Variables:: Variables which are valid for buffers with a | ||
| 769 | remote default directory. | ||
| 768 | @end menu | 770 | @end menu |
| 769 | 771 | ||
| 770 | @node Examining | 772 | @node Examining |
| @@ -1421,6 +1423,52 @@ variables are handled in the same way as unsafe file-local variables | |||
| 1421 | do not visit a file directly but perform work within a directory, such | 1423 | do not visit a file directly but perform work within a directory, such |
| 1422 | as Dired buffers (@pxref{Dired}). | 1424 | as Dired buffers (@pxref{Dired}). |
| 1423 | 1425 | ||
| 1426 | @node Connection Variables | ||
| 1427 | @subsection Per-Connection Local Variables | ||
| 1428 | @cindex local variables, for all remote connections | ||
| 1429 | @cindex connection-local variables | ||
| 1430 | @cindex per-connection local variables | ||
| 1431 | |||
| 1432 | Most of the variables reflect the situation on the local machine. | ||
| 1433 | Often, they must use a different value when you operate in buffers | ||
| 1434 | with a remote default directory. Think about the shell to be applied | ||
| 1435 | when calling @code{shell} -- it might be @file{/bin/bash} on your | ||
| 1436 | local machine, and @file{/bin/ksh} on a remote machine. | ||
| 1437 | |||
| 1438 | This can be accomplished with @dfn{connection-local variables}. | ||
| 1439 | Directory and file local variables override connection-local | ||
| 1440 | variables. Unsafe connection-local variables are handled in the same | ||
| 1441 | way as unsafe file-local variables (@pxref{Safe File Variables}). | ||
| 1442 | |||
| 1443 | @findex connection-local-set-profile-variables | ||
| 1444 | @findex connection-local-set-profiles | ||
| 1445 | Connection-local variables are declared as a group of | ||
| 1446 | variables/value pairs in a @dfn{profile}, using the | ||
| 1447 | @code{connection-local-set-profile-variables} function. The function | ||
| 1448 | @code{connection-local-set-profiles} activates profiles for a given | ||
| 1449 | criteria, identifying a remote machine: | ||
| 1450 | |||
| 1451 | @example | ||
| 1452 | (connection-local-set-profile-variables 'remote-ksh | ||
| 1453 | '((shell-file-name . "/bin/ksh") | ||
| 1454 | (shell-command-switch . "-c"))) | ||
| 1455 | |||
| 1456 | (connection-local-set-profile-variables 'remote-bash | ||
| 1457 | '((shell-file-name . "/bin/bash") | ||
| 1458 | (shell-command-switch . "-c"))) | ||
| 1459 | |||
| 1460 | (connection-local-set-profiles | ||
| 1461 | '(:application tramp :machine "remotemachine") 'remote-ksh) | ||
| 1462 | @end example | ||
| 1463 | |||
| 1464 | This code declares two different profiles, @code{remote-ksh} and | ||
| 1465 | @code{remote-bash}. The profile @code{remote-ksh} is applied to all | ||
| 1466 | buffers which have a remote default directory matching the regexp | ||
| 1467 | @code{"remotemachine} as host name. Such a criteria can also | ||
| 1468 | discriminate for the properties @code{:protocol} (this is the Tramp | ||
| 1469 | method) or @code{:user} (a remote user name). The @code{nil} criteria | ||
| 1470 | matches all buffers with a remote default directory. | ||
| 1471 | |||
| 1424 | @node Key Bindings | 1472 | @node Key Bindings |
| 1425 | @section Customizing Key Bindings | 1473 | @section Customizing Key Bindings |
| 1426 | @cindex key bindings | 1474 | @cindex key bindings |
diff --git a/doc/emacs/emacs.texi b/doc/emacs/emacs.texi index 950ddc01123..7edc1a5fae1 100644 --- a/doc/emacs/emacs.texi +++ b/doc/emacs/emacs.texi | |||
| @@ -1135,6 +1135,8 @@ Variables | |||
| 1135 | * Locals:: Per-buffer values of variables. | 1135 | * Locals:: Per-buffer values of variables. |
| 1136 | * File Variables:: How files can specify variable values. | 1136 | * File Variables:: How files can specify variable values. |
| 1137 | * Directory Variables:: How variable values can be specified by directory. | 1137 | * Directory Variables:: How variable values can be specified by directory. |
| 1138 | * Connection Variables:: Variables which are valid for buffers with a | ||
| 1139 | remote default directory. | ||
| 1138 | 1140 | ||
| 1139 | Local Variables in Files | 1141 | Local Variables in Files |
| 1140 | 1142 | ||
diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi index a3aa71e2672..7d7065a441a 100644 --- a/doc/emacs/misc.texi +++ b/doc/emacs/misc.texi | |||
| @@ -795,6 +795,10 @@ to @command{gpg}. This will output the list of keys to the | |||
| 795 | name is relative, Emacs searches the directories listed in | 795 | name is relative, Emacs searches the directories listed in |
| 796 | @code{exec-path} (@pxref{Shell}). | 796 | @code{exec-path} (@pxref{Shell}). |
| 797 | 797 | ||
| 798 | If the default directory is remote (@pxref{Remote Files}), the | ||
| 799 | default value is @file{/bin/sh}. This can be changed by declaring | ||
| 800 | @code{shell-file-name} connection-local (@pxref{Connection Variables}). | ||
| 801 | |||
| 798 | To specify a coding system for @kbd{M-!} or @kbd{M-|}, use the command | 802 | To specify a coding system for @kbd{M-!} or @kbd{M-|}, use the command |
| 799 | @kbd{C-x @key{RET} c} immediately beforehand. @xref{Communication Coding}. | 803 | @kbd{C-x @key{RET} c} immediately beforehand. @xref{Communication Coding}. |
| 800 | 804 | ||
diff --git a/doc/lispref/variables.texi b/doc/lispref/variables.texi index f1e0e37e6d6..aca7d2f5e93 100644 --- a/doc/lispref/variables.texi +++ b/doc/lispref/variables.texi | |||
| @@ -2191,9 +2191,9 @@ This function looks for connection-local variables according to | |||
| 2191 | @var{criteria}, and immediately applies them in the current buffer. | 2191 | @var{criteria}, and immediately applies them in the current buffer. |
| 2192 | @end defun | 2192 | @end defun |
| 2193 | 2193 | ||
| 2194 | @defmac with-connection-local-profiles profiles &rest body | 2194 | @defmac with-connection-local-variables &rest body |
| 2195 | All connection-local variables, which are specified by a connection | 2195 | All connection-local variables, which are specified by |
| 2196 | profile in @var{profiles}, are applied. | 2196 | @code{default-directory}, are applied. |
| 2197 | 2197 | ||
| 2198 | After that, @var{body} is executed, and the connection-local variables | 2198 | After that, @var{body} is executed, and the connection-local variables |
| 2199 | are unwound. Example: | 2199 | are unwound. Example: |
| @@ -2207,8 +2207,15 @@ are unwound. Example: | |||
| 2207 | @end group | 2207 | @end group |
| 2208 | 2208 | ||
| 2209 | @group | 2209 | @group |
| 2210 | (with-connection-local-profiles '(remote-perl) | 2210 | (connection-local-set-profiles |
| 2211 | do something useful) | 2211 | '(:application 'tramp :protocol "ssh" :machine "remotehost") |
| 2212 | 'remote-perl) | ||
| 2213 | @end group | ||
| 2214 | |||
| 2215 | @group | ||
| 2216 | (let ((default-directory "/ssh:remotehost:/working/dir/")) | ||
| 2217 | (with-connection-local-variables | ||
| 2218 | do something useful)) | ||
| 2212 | @end group | 2219 | @end group |
| 2213 | @end example | 2220 | @end example |
| 2214 | @end defmac | 2221 | @end defmac |
diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi index db3b3f7fee5..ea6ad15dc3d 100644 --- a/doc/misc/tramp.texi +++ b/doc/misc/tramp.texi | |||
| @@ -2970,7 +2970,7 @@ Starting with Emacs 26, you could use connection-local variables for | |||
| 2970 | setting different values of @code{explicit-shell-file-name} for | 2970 | setting different values of @code{explicit-shell-file-name} for |
| 2971 | different remote hosts. | 2971 | different remote hosts. |
| 2972 | @ifinfo | 2972 | @ifinfo |
| 2973 | @pxref{Connection Local Variables, , , elisp} | 2973 | @xref{Connection Variables, , , emacs} |
| 2974 | @end ifinfo | 2974 | @end ifinfo |
| 2975 | 2975 | ||
| 2976 | @lisp | 2976 | @lisp |
| @@ -3023,6 +3023,14 @@ host. Example: | |||
| 3023 | @kbd{M-x auto-revert-tail-mode @key{RET}} runs similarly showing | 3023 | @kbd{M-x auto-revert-tail-mode @key{RET}} runs similarly showing |
| 3024 | continuous output. | 3024 | continuous output. |
| 3025 | 3025 | ||
| 3026 | @code{shell-command} uses the variables @code{shell-file-name} and | ||
| 3027 | @code{shell-command-switch} in order to determine which shell to run. | ||
| 3028 | For remote hosts, their default values are @file{/bin/sh} and | ||
| 3029 | @option{-c}, respectively (except for the @option{adb} method, which | ||
| 3030 | uses @file{/system/bin/sh}). Like the variables in the previous | ||
| 3031 | section, these variables can be changed via connection-local | ||
| 3032 | variables. | ||
| 3033 | |||
| 3026 | 3034 | ||
| 3027 | @subsection Running @code{eshell} on a remote host | 3035 | @subsection Running @code{eshell} on a remote host |
| 3028 | @cindex @code{eshell} | 3036 | @cindex @code{eshell} |