summaryrefslogtreecommitdiff
path: root/devdocs/elisp/connection-local-variables.html
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
committerCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
commit754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 (patch)
treef1190704f78f04a2b0b4c977d20fe96a828377f1 /devdocs/elisp/connection-local-variables.html
new repository
Diffstat (limited to 'devdocs/elisp/connection-local-variables.html')
-rw-r--r--devdocs/elisp/connection-local-variables.html97
1 files changed, 97 insertions, 0 deletions
diff --git a/devdocs/elisp/connection-local-variables.html b/devdocs/elisp/connection-local-variables.html
new file mode 100644
index 00000000..af242bcf
--- /dev/null
+++ b/devdocs/elisp/connection-local-variables.html
@@ -0,0 +1,97 @@
+ <h3 class="section">Connection Local Variables</h3> <p>Connection-local variables provide a general mechanism for different variable settings in buffers with a remote connection. They are bound and set depending on the remote connection a buffer is dedicated to. </p> <dl> <dt id="connection-local-set-profile-variables">Function: <strong>connection-local-set-profile-variables</strong> <em>profile variables</em>
+</dt> <dd>
+<p>This function defines a set of variable settings for the connection <var>profile</var>, which is a symbol. You can later assign the connection profile to one or more remote connections, and Emacs will apply those variable settings to all process buffers for those connections. The list in <var>variables</var> is an alist of the form <code>(<var>name</var> . <var>value</var>)</code>. Example: </p> <div class="example"> <pre class="example">(connection-local-set-profile-variables
+ 'remote-bash
+ '((shell-file-name . "/bin/bash")
+ (shell-command-switch . "-c")
+ (shell-interactive-switch . "-i")
+ (shell-login-switch . "-l")))
+</pre>
+
+<pre class="example">(connection-local-set-profile-variables
+ 'remote-ksh
+ '((shell-file-name . "/bin/ksh")
+ (shell-command-switch . "-c")
+ (shell-interactive-switch . "-i")
+ (shell-login-switch . "-l")))
+</pre>
+
+<pre class="example">(connection-local-set-profile-variables
+ 'remote-null-device
+ '((null-device . "/dev/null")))
+</pre>
+</div> </dd>
+</dl> <dl> <dt id="connection-local-profile-alist">Variable: <strong>connection-local-profile-alist</strong>
+</dt> <dd><p>This alist holds the connection profile symbols and the associated variable settings. It is updated by <code>connection-local-set-profile-variables</code>. </p></dd>
+</dl> <dl> <dt id="connection-local-set-profiles">Function: <strong>connection-local-set-profiles</strong> <em>criteria &amp;rest profiles</em>
+</dt> <dd>
+<p>This function assigns <var>profiles</var>, which are symbols, to all remote connections identified by <var>criteria</var>. <var>criteria</var> is a plist identifying a connection and the application using this connection. Property names might be <code>:application</code>, <code>:protocol</code>, <code>:user</code> and <code>:machine</code>. The property value of <code>:application</code> is a symbol, all other property values are strings. All properties are optional; if <var>criteria</var> is <code>nil</code>, it always applies. Example: </p> <div class="example"> <pre class="example">(connection-local-set-profiles
+ '(:application 'tramp :protocol "ssh" :machine "localhost")
+ 'remote-bash 'remote-null-device)
+</pre>
+
+<pre class="example">(connection-local-set-profiles
+ '(:application 'tramp :protocol "sudo"
+ :user "root" :machine "localhost")
+ 'remote-ksh 'remote-null-device)
+</pre>
+</div> <p>If <var>criteria</var> is <code>nil</code>, it applies for all remote connections. Therefore, the example above would be equivalent to </p> <div class="example"> <pre class="example">(connection-local-set-profiles
+ '(:application 'tramp :protocol "ssh" :machine "localhost")
+ 'remote-bash)
+</pre>
+
+<pre class="example">(connection-local-set-profiles
+ '(:application 'tramp :protocol "sudo"
+ :user "root" :machine "localhost")
+ 'remote-ksh)
+</pre>
+
+<pre class="example">(connection-local-set-profiles
+ nil 'remote-null-device)
+</pre>
+</div> <p>Any connection profile of <var>profiles</var> must have been already defined by <code>connection-local-set-profile-variables</code>. </p>
+</dd>
+</dl> <dl> <dt id="connection-local-criteria-alist">Variable: <strong>connection-local-criteria-alist</strong>
+</dt> <dd><p>This alist contains connection criteria and their assigned profile names. The function <code>connection-local-set-profiles</code> updates this list. </p></dd>
+</dl> <dl> <dt id="hack-connection-local-variables">Function: <strong>hack-connection-local-variables</strong> <em>criteria</em>
+</dt> <dd>
+<p>This function collects applicable connection-local variables associated with <var>criteria</var> in <code>connection-local-variables-alist</code>, without applying them. Example: </p> <div class="example"> <pre class="example">(hack-connection-local-variables
+ '(:application 'tramp :protocol "ssh" :machine "localhost"))
+</pre>
+
+<pre class="example">connection-local-variables-alist
+ ⇒ ((null-device . "/dev/null")
+ (shell-login-switch . "-l")
+ (shell-interactive-switch . "-i")
+ (shell-command-switch . "-c")
+ (shell-file-name . "/bin/bash"))
+</pre>
+</div> </dd>
+</dl> <dl> <dt id="hack-connection-local-variables-apply">Function: <strong>hack-connection-local-variables-apply</strong> <em>criteria</em>
+</dt> <dd><p>This function looks for connection-local variables according to <var>criteria</var>, and immediately applies them in the current buffer. </p></dd>
+</dl> <dl> <dt id="with-connection-local-variables">Macro: <strong>with-connection-local-variables</strong> <em>&amp;rest body</em>
+</dt> <dd>
+<p>All connection-local variables, which are specified by <code>default-directory</code>, are applied. </p> <p>After that, <var>body</var> is executed, and the connection-local variables are unwound. Example: </p> <div class="example"> <pre class="example">(connection-local-set-profile-variables
+ 'remote-perl
+ '((perl-command-name . "/usr/local/bin/perl")
+ (perl-command-switch . "-e %s")))
+</pre>
+
+<pre class="example">(connection-local-set-profiles
+ '(:application 'tramp :protocol "ssh" :machine "remotehost")
+ 'remote-perl)
+</pre>
+
+<pre class="example">(let ((default-directory "/ssh:remotehost:/working/dir/"))
+ (with-connection-local-variables
+ do something useful))
+</pre>
+</div> </dd>
+</dl> <dl> <dt id="enable-connection-local-variables">Variable: <strong>enable-connection-local-variables</strong>
+</dt> <dd><p>If <code>nil</code>, connection-local variables are ignored. This variable shall be changed temporarily only in special modes. </p></dd>
+</dl><div class="_attribution">
+ <p class="_attribution-p">
+ Copyright &copy; 1990-1996, 1998-2022 Free Software Foundation, Inc. <br>Licensed under the GNU GPL license.<br>
+ <a href="https://www.gnu.org/software/emacs/manual/html_node/elisp/Connection-Local-Variables.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/Connection-Local-Variables.html</a>
+ </p>
+</div>