From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#26591: 26.0.50; Using local emacs+tramp with remote emacsclient Date: Fri, 28 Apr 2017 12:42:27 +0300 Message-ID: <83k264na0s.fsf@gnu.org> References: Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1493372652 20321 195.159.176.226 (28 Apr 2017 09:44:12 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 28 Apr 2017 09:44:12 +0000 (UTC) Cc: 26591@debbugs.gnu.org To: peder@klingenberg.no (Peder O. Klingenberg) Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Apr 28 11:44:08 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d42Rb-0005BU-5f for geb-bug-gnu-emacs@m.gmane.org; Fri, 28 Apr 2017 11:44:07 +0200 Original-Received: from localhost ([::1]:36081 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d42Rh-0003rU-1D for geb-bug-gnu-emacs@m.gmane.org; Fri, 28 Apr 2017 05:44:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:32773) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d42Rb-0003rP-JS for bug-gnu-emacs@gnu.org; Fri, 28 Apr 2017 05:44:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d42RW-0007mb-Mf for bug-gnu-emacs@gnu.org; Fri, 28 Apr 2017 05:44:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:45424) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d42RW-0007mT-J0 for bug-gnu-emacs@gnu.org; Fri, 28 Apr 2017 05:44:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1d42RW-0006Sr-AV for bug-gnu-emacs@gnu.org; Fri, 28 Apr 2017 05:44:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 28 Apr 2017 09:44:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 26591 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 26591-submit@debbugs.gnu.org id=B26591.149337259424787 (code B ref 26591); Fri, 28 Apr 2017 09:44:02 +0000 Original-Received: (at 26591) by debbugs.gnu.org; 28 Apr 2017 09:43:14 +0000 Original-Received: from localhost ([127.0.0.1]:43623 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d42Qk-0006Ri-06 for submit@debbugs.gnu.org; Fri, 28 Apr 2017 05:43:14 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:41574) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d42Qi-0006RV-33 for 26591@debbugs.gnu.org; Fri, 28 Apr 2017 05:43:12 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d42QY-0007W2-21 for 26591@debbugs.gnu.org; Fri, 28 Apr 2017 05:43:06 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:60070) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d42QX-0007Vy-UC; Fri, 28 Apr 2017 05:43:01 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:2720 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1d42QX-00083e-9w; Fri, 28 Apr 2017 05:43:01 -0400 In-reply-to: (peder@klingenberg.no) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:132074 Archived-At: > From: peder@klingenberg.no (Peder O. Klingenberg) > Date: Fri, 21 Apr 2017 18:15:25 +0200 > > My workstation is running a bleeding edge emacs full-screen in a > dedicated display. When working on a server, from time to time I use > programs that invoke the shell EDITOR. I can set EDITOR to emacsclient, > but that will just open emacs on the remote machine, which is not what I > want. I want whatever editing job needs doing to pop up in my local > fullscreen emacs. > > I can ssh to the server, so obviously I can use my local emacs to edit > files there via Tramp. And server.el already has functionality for > listening on a TCP port, which is easily forwarded over ssh (there are > various hacks out there for forwarding unix domain sockets as well, > which I haven't tried). > > The missing piece is simply a way to let emacsclient instruct emacs that > the files it passes to emacs are remote. Attached is a patch for your > consideration which accomplishes this. > > Additionally, it would be handy to have some tooling for conveniently > forwarding the correct ports and setting up EDITOR with the correct -T > option on the remote machine, but that is outside the scope of emacs > code, I think. Thanks, I think this will be a welcome feature. Please see a few comments below. > --- a/doc/emacs/misc.texi > +++ b/doc/emacs/misc.texi > @@ -1872,6 +1872,36 @@ emacsclient Options > server is using the graphical display, but if the Emacs server is > running on a text terminal, it creates a new frame in the current text > terminal. > + > +@item -T @var{tramp-prefix} > +@itemx --tramp-prefix=@var{tramp-prefix} > +@cindex @env{EMACSCLIENT_TRAMP} environment variable > +Prefix to add to filenames for emacs to locate files on remote > +machines through TRAMP. This is mostly useful in combination with > +setting @code{server-use-tcp} to non-@code{nil}, ssh-forwarding the > +listening port, and making the @var{server-file} available to > +@command{emacsclient}. server-use-tcp is not described in the manual, so I think we should add its description somewhere, and then reference that place from this text. > +For example, assume two hosts, @samp{local} and @samp{remote}, with > +@samp{/home} on a shared file system, and that the local emacs listens > +on tcp port 12345: "/home" should be in @file, not @samp. Also, I don't see "/home" used anywhere in the example, so something is missing here. > +@example > +local$ ssh -R12345:localhost:12345 remote > +remote$ export EDITOR="emacsclient \ > + --server-file=server \ > + --tramp=/ssh:remote:' The value of EDITOR begins with a ", but ends with a ', which is probably a mistake. > + if (tramp_prefix && file_name_absolute_p (argv[i])) > + quote_argument (emacs_socket, tramp_prefix); Why the test for argv[i] being an absolute file name? And if relative file names cannot be supported, I think emacsclient should emit an error message rather than silently ignoring --tramp.