[Top][All Lists]

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

Re: possible to exchange server and client?

From: Pascal J. Bourguignon
Subject: Re: possible to exchange server and client?
Date: Mon, 14 Jul 2008 11:56:04 +0200
User-agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/22.2 (gnu/linux)

Peter Dyballa <address@hidden> writes:

> Am 14.07.2008 um 02:20 schrieb anhnmncb:
>> So I want to know, in this condition, if I can start an emacsclient
>> in console, then let it become server(old emacs server on Xorg
>> becomes client now), then close the emacs(old server) on Xorg,
>> restart Xorg, run emacsclient, let it become server again?

I still don't understand very well what the OP wants, but this might help.

Sometimes, I have an emacs running on host A, I connect from host B to
host A with ssh -X, and I want to open a frame of the running emacs on
a X display on host B.

To do that, I plan ahead, and have this in my ~/.emacs (on host A):

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

(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))


Then I only have to create the job ticket:

B> ssh -X address@hidden
A> echo $DISPLAY > ~/.frame-emacs

and wait for the frame to appear on B.

Nowadays, this could also be done simply with:

B> ssh -X address@hidden
A> emacsclient -e '(make-frame-on-display "'"$DISPLAY"'")'

__Pascal Bourguignon__           

THIS IS A 100% MATTER PRODUCT: In the unlikely event that this
merchandise should contact antimatter in any form, a catastrophic
explosion will result.

reply via email to

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