diff options
Diffstat (limited to 'doc/emacs/custom.texi')
-rw-r--r-- | doc/emacs/custom.texi | 48 |
1 files changed, 48 insertions, 0 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}). * Locals:: Per-buffer values of variables. * File Variables:: How files can specify variable values. * Directory Variables:: How variable values can be specified by directory. +* Connection Variables:: Variables which are valid for buffers with a + remote default directory. @end menu @node Examining @@ -1421,6 +1423,52 @@ variables are handled in the same way as unsafe file-local variables do not visit a file directly but perform work within a directory, such as Dired buffers (@pxref{Dired}). +@node Connection Variables +@subsection Per-Connection Local Variables +@cindex local variables, for all remote connections +@cindex connection-local variables +@cindex per-connection local variables + + Most of the variables reflect the situation on the local machine. +Often, they must use a different value when you operate in buffers +with a remote default directory. Think about the shell to be applied +when calling @code{shell} -- it might be @file{/bin/bash} on your +local machine, and @file{/bin/ksh} on a remote machine. + + This can be accomplished with @dfn{connection-local variables}. +Directory and file local variables override connection-local +variables. Unsafe connection-local variables are handled in the same +way as unsafe file-local variables (@pxref{Safe File Variables}). + +@findex connection-local-set-profile-variables +@findex connection-local-set-profiles + Connection-local variables are declared as a group of +variables/value pairs in a @dfn{profile}, using the +@code{connection-local-set-profile-variables} function. The function +@code{connection-local-set-profiles} activates profiles for a given +criteria, identifying a remote machine: + +@example +(connection-local-set-profile-variables 'remote-ksh + '((shell-file-name . "/bin/ksh") + (shell-command-switch . "-c"))) + +(connection-local-set-profile-variables 'remote-bash + '((shell-file-name . "/bin/bash") + (shell-command-switch . "-c"))) + +(connection-local-set-profiles + '(:application tramp :machine "remotemachine") 'remote-ksh) +@end example + + This code declares two different profiles, @code{remote-ksh} and +@code{remote-bash}. The profile @code{remote-ksh} is applied to all +buffers which have a remote default directory matching the regexp +@code{"remotemachine} as host name. Such a criteria can also +discriminate for the properties @code{:protocol} (this is the Tramp +method) or @code{:user} (a remote user name). The @code{nil} criteria +matches all buffers with a remote default directory. + @node Key Bindings @section Customizing Key Bindings @cindex key bindings |