unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Pascal Bourguignon <pjb@informatimago.com>
Subject: Re: Connecting to remote Emacs?
Date: Wed, 14 Jun 2006 20:55:03 +0200	[thread overview]
Message-ID: <87d5dbva7s.fsf@thalassa.informatimago.com> (raw)
In-Reply-To: mailman.2882.1150295429.9609.help-gnu-emacs@gnu.org

Andrea Russo <rastandy@salug.it> writes:

> alistair_happencross@hotmail.com writes:
>
>> I'd like to be able to reconnect to the running Emacs process and have
>> it display on my X server at home.  Is this possible?
>
> In the X11 forwarded ssh shell:
>
> $ emacsclient -e "(make-frame-on-display \"$DISPLAY\")"
>
> Of course you should have started the emacs server with (server-start)
> in your .emacs file.

This -e option is new. (Did it work already in 21.3?)
Moreover, it works only on the only emacs server per user.

I've got three emacs running (one for erc, one for gnu and one for
programming, given the lack of threads in emacs...). 

So I have this in my ~/.emacs:



(defvar *frame-server-job-ticket* "~/frame-emacs"
         "Path to the job-ticket file.")
(setf *frame-server-job-ticket* "~/frame-emacs")

(defun frame-server (&optional token-path)
  (setf token-path (or token-path *frame-server-job-ticket*))
  (when (file-exists-p token-path)
    (find-file token-path)
    (make-frame-on-display
     (delete ?\n (prog1 (buffer-string)
                   (kill-buffer (current-buffer))
                   (delete-file token-path)))
     (list (cons 'name (format "n%s" (frame-parameter nil 'name)))))))

(defun frame-server-start ()
  (interactive)
  (run-at-time nil 5 (function frame-server) nil))

(frame-server-start)

(cond
  ((member "(gnus)"  command-line-args)
   (setf *frame-server-job-ticket* "~/frame-gnus"))
  ((member "(irc)"  command-line-args)
   (setf *frame-server-job-ticket* "~/frame-erc"))
  (t
   (server-start)
   (setf *frame-server-job-ticket* "~/frame-emacs")))


and I can open a new frame writing the display where to make it in one
of these files: ~/frame-gnus ~/frame-erc or ~/frame-emacs
for example with:

echo $(hostname -f)$DISPLAY | ssh $REMOTE tee -a ~/frame-emacs \
                                              -a ~/frame-gnus  \
                                              -a ~/frame-erc

or, if you want it thru ssh:

ssh -X bash -c 'echo $DISPLAY | tee -a ~/frame-emacs \
                                    -a ~/frame-gnus  \
                                    -a ~/frame-erc '

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

"Indentation! -- I will show you how to indent when I indent your skull!"

  parent reply	other threads:[~2006-06-14 18:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-14  9:39 Connecting to remote Emacs? alistair_happencross
2006-06-14 13:41 ` Andrea Russo
2006-06-14 14:38 ` Xiao-Yong Jin
     [not found] ` <mailman.2882.1150295429.9609.help-gnu-emacs@gnu.org>
2006-06-14 18:55   ` Pascal Bourguignon [this message]
2006-06-14 20:17     ` Xiao-Yong Jin
2006-06-16 19:04     ` alistair_happencross
2006-06-16 19:08     ` alistair_happencross
2006-06-16  2:15   ` Xiao-Yong Jin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87d5dbva7s.fsf@thalassa.informatimago.com \
    --to=pjb@informatimago.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).