[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Connecting to remote Emacs?

From: Pascal Bourguignon
Subject: Re: Connecting to remote Emacs?
Date: Wed, 14 Jun 2006 20:55:03 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

Andrea Russo <> writes:

> 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)
     (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 ()
  (run-at-time nil 5 (function frame-server) nil))


  ((member "(gnus)"  command-line-args)
   (setf *frame-server-job-ticket* "~/frame-gnus"))
  ((member "(irc)"  command-line-args)
   (setf *frame-server-job-ticket* "~/frame-erc"))
   (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__           

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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]