mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-06 06:20:55 -08:00
Support remote editing in emacsclient via Tramp
* lib-src/emacsclient.c (main, decode_options) (print_help_and_exit, longopts): New option '--tramp' / '-T' which specifies how emacs should use tramp to find remote files. * doc/emacs/misc.texi (TCP Emacs server): New subsection describing the various knobs to tune server.el for TCP opereation. (emacsclient Options): Reference "TCP Emacs server" from description of --server-file. Document the new '--tramp' / '-T' options. * doc/emacs/emacs.texi (Top): Update the top-level menu. * etc/NEWS: Mention the new option.
This commit is contained in:
parent
bb5c6614eb
commit
7430617d3d
4 changed files with 127 additions and 20 deletions
|
|
@ -149,6 +149,9 @@ const char *socket_name = NULL;
|
|||
/* If non-NULL, the filename of the authentication file. */
|
||||
const char *server_file = NULL;
|
||||
|
||||
/* If non-NULL, the tramp prefix emacs must use to find the files. */
|
||||
const char *tramp_prefix = NULL;
|
||||
|
||||
/* PID of the Emacs server process. */
|
||||
int emacs_pid = 0;
|
||||
|
||||
|
|
@ -178,6 +181,7 @@ struct option longopts[] =
|
|||
{ "server-file", required_argument, NULL, 'f' },
|
||||
{ "display", required_argument, NULL, 'd' },
|
||||
{ "parent-id", required_argument, NULL, 'p' },
|
||||
{ "tramp", required_argument, NULL, 'T' },
|
||||
{ 0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
|
|
@ -468,14 +472,15 @@ static void
|
|||
decode_options (int argc, char **argv)
|
||||
{
|
||||
alternate_editor = egetenv ("ALTERNATE_EDITOR");
|
||||
tramp_prefix = egetenv ("EMACSCLIENT_TRAMP");
|
||||
|
||||
while (1)
|
||||
{
|
||||
int opt = getopt_long_only (argc, argv,
|
||||
#ifndef NO_SOCKETS_IN_FILE_SYSTEM
|
||||
"VHnequa:s:f:d:F:tc",
|
||||
"VHnequa:s:f:d:F:tcT:",
|
||||
#else
|
||||
"VHnequa:f:d:F:tc",
|
||||
"VHnequa:f:d:F:tcT:",
|
||||
#endif
|
||||
longopts, 0);
|
||||
|
||||
|
|
@ -554,6 +559,10 @@ decode_options (int argc, char **argv)
|
|||
frame_parameters = optarg;
|
||||
break;
|
||||
|
||||
case 'T':
|
||||
tramp_prefix = optarg;
|
||||
break;
|
||||
|
||||
default:
|
||||
message (true, "Try '%s --help' for more information\n", progname);
|
||||
exit (EXIT_FAILURE);
|
||||
|
|
@ -654,6 +663,9 @@ The following OPTIONS are accepted:\n\
|
|||
Editor to fallback to if the server is not running\n"
|
||||
" If EDITOR is the empty string, start Emacs in daemon\n\
|
||||
mode and try connecting again\n"
|
||||
"-T PREFIX, --tramp=PREFIX\n\
|
||||
PREFIX to prepend to filenames sent by emacsclient\n\
|
||||
for locating files remotely via Tramp\n"
|
||||
"\n\
|
||||
Report bugs with M-x report-emacs-bug.\n");
|
||||
exit (EXIT_SUCCESS);
|
||||
|
|
@ -1687,6 +1699,8 @@ main (int argc, char **argv)
|
|||
}
|
||||
}
|
||||
send_to_emacs (emacs_socket, "-dir ");
|
||||
if (tramp_prefix)
|
||||
quote_argument (emacs_socket, tramp_prefix);
|
||||
quote_argument (emacs_socket, cwd);
|
||||
send_to_emacs (emacs_socket, "/");
|
||||
send_to_emacs (emacs_socket, " ");
|
||||
|
|
@ -1791,6 +1805,8 @@ main (int argc, char **argv)
|
|||
#endif
|
||||
|
||||
send_to_emacs (emacs_socket, "-file ");
|
||||
if (tramp_prefix && file_name_absolute_p (argv[i]))
|
||||
quote_argument (emacs_socket, tramp_prefix);
|
||||
quote_argument (emacs_socket, argv[i]);
|
||||
send_to_emacs (emacs_socket, " ");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue