aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Oliver2024-04-10 10:42:39 +0200
committerMichael Albinus2024-04-10 10:42:39 +0200
commit6a0bb7beae3ed4e3d2b420b73abcfaada38f53ee (patch)
tree9eb7d94768f9ae7d3deb87b292ad0598fa995990
parent859b4227e3de9f8e7bc26367540aa315cefc37dc (diff)
downloademacs-6a0bb7beae3ed4e3d2b420b73abcfaada38f53ee.tar.gz
emacs-6a0bb7beae3ed4e3d2b420b73abcfaada38f53ee.zip
* doc/emacs/misc.texi (emacsclient Options): Suggest forwarding sockets.
(Bug#66667)
-rw-r--r--doc/emacs/misc.texi28
1 files changed, 21 insertions, 7 deletions
diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi
index 488f6de04ed..41e37fd094e 100644
--- a/doc/emacs/misc.texi
+++ b/doc/emacs/misc.texi
@@ -2161,8 +2161,9 @@ terminal.
2161Set the prefix to add to filenames for Emacs to locate files on remote 2161Set the prefix to add to filenames for Emacs to locate files on remote
2162machines (@pxref{Remote Files}) using TRAMP (@pxref{Top, The Tramp 2162machines (@pxref{Remote Files}) using TRAMP (@pxref{Top, The Tramp
2163Manual,, tramp, The Tramp Manual}). This is mostly useful in 2163Manual,, tramp, The Tramp Manual}). This is mostly useful in
2164combination with using the Emacs server over TCP (@pxref{TCP Emacs 2164combination with using the Emacs server from a remote host. By
2165server}). By ssh-forwarding the listening port and making the 2165ssh-forwarding the listening socket, or ssh-forwarding the listening
2166port @pxref{TCP Emacs server} and making the
2166@var{server-file} available on a remote machine, programs on the 2167@var{server-file} available on a remote machine, programs on the
2167remote machine can use @command{emacsclient} as the value for the 2168remote machine can use @command{emacsclient} as the value for the
2168@env{EDITOR} and similar environment variables, but instead of talking 2169@env{EDITOR} and similar environment variables, but instead of talking
@@ -2174,16 +2175,29 @@ Setting the environment variable @env{EMACSCLIENT_TRAMP} has the same
2174effect as using the @samp{-T} option. If both are specified, the 2175effect as using the @samp{-T} option. If both are specified, the
2175command-line option takes precedence. 2176command-line option takes precedence.
2176 2177
2177For example, assume two hosts, @samp{local} and @samp{remote}, and 2178For example, assume two hosts, @samp{local} and @samp{remote}.
2178that the local Emacs listens on tcp port 12345. Assume further that 2179
2180@example
2181local$ ssh -R "/home/%r/.emacs.socket":"$@{XDG_RUNTIME_DIR:-$@{TMPDIR:-/tmp@}/emacs%i@}$@{XDG_RUNTIME_DIR:+/emacs@}/server" remote
2182remote$ export EMACS_SOCKET_NAME=$HOME/.emacs.socket
2183remote$ export EMACSCLIENT_TRAMP=/ssh:remote:
2184remote$ export EDITOR=emacsclient
2185remote$ $EDITOR /tmp/foo.txt #Should open in local emacs.
2186@end example
2187
2188If you are using a platform where @command{emacsclient} does not use
2189Unix domain sockets (i.e., MS-Windows), or your SSH implementation is
2190not able to forward them (e.g., OpenSSH before version 6.7), you can
2191forward a TCP port instead. In this example, assume that the local
2192Emacs listens on tcp port 12345. Assume further that
2179@file{/home} is on a shared file system, so that the server file 2193@file{/home} is on a shared file system, so that the server file
2180@file{~/.emacs.d/server/server} is readable on both hosts. 2194@file{~/.emacs.d/server/server} is readable on both hosts.
2181 2195
2182@example 2196@example
2183local$ ssh -R12345:localhost:12345 remote 2197local$ ssh -R12345:localhost:12345 remote
2184remote$ export EDITOR="emacsclient \ 2198remote$ export EMACS_SERVER_FILE=server
2185 --server-file=server \ 2199remote$ export EMACSCLIENT_TRAMP=/ssh:remote:
2186 --tramp=/ssh:remote:" 2200remote$ export EDITOR=emacsclient
2187remote$ $EDITOR /tmp/foo.txt #Should open in local emacs. 2201remote$ $EDITOR /tmp/foo.txt #Should open in local emacs.
2188@end example 2202@end example
2189 2203