[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Connecting to remote Emacs?
From: |
Xiao-Yong Jin |
Subject: |
Re: Connecting to remote Emacs? |
Date: |
Wed, 14 Jun 2006 16:17:16 -0400 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/23.0.0 (gnu/linux) |
Pascal Bourguignon <pjb@informatimago.com> writes:
> 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!"
Great idea!
Xiao-Yong