[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: multiple users, one emacs - how?
From: |
Pascal Bourguignon |
Subject: |
Re: multiple users, one emacs - how? |
Date: |
Sun, 04 Jun 2006 03:04:24 +0200 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) |
Joe Corneli <jcorneli@planetmath.org> writes:
> The closest I've found to an answer is the suggestion by Pascal
> in the thread "howto: 2 users interactively edit the same file ?",
>
> http://lists.gnu.org/archive/html/help-gnu-emacs/2005-10/msg00842.html
>
> I haven't had a chance to try this -- but I am primarily interested in
> a solution that doesn't involve/require X (e.g. because me and my
> collaborators are typically editing files in cybercafes, where it is
> AFAIK impossible to determine an actual IP address for the computer --
> if I'm wrong about this, I'd be willing to accept an X windows
> solution).
Well, when you connect to a remote host, you can know the IP. But
you're right, you may be behind a NAT router. In that case, you can
send the X traffic thru ssh: ssh publishes a X display on a local port
on the remote that it forward back to the client, so you can have the
display on the local computer with:
ssh -X remote.host xclock -display localhost:10
for example.
> Ideally (at least for now) what I'd like would be to have a copy of
> emacs running on a computer somewhere where we'd log in via shell
> accounts, and then we'd e.g. fire up an emacsclient and all get access
> to that emacs's state.
>
> It seems to be insinuated that (or anyway I've imagined) emacsclient
> can actually do this. (Cf. this thread:
> http://lists.gnu.org/archive/html/help-gnu-emacs/2005-08/msg00226.html)
>
> Is this the case? Can emacsclient be used by multiple users to access
> the same emacs through a shell? Or, if not emacsclient, can anyone
> suggest a good solution?
You have several options.
You could use the multitty branch of emacs, which allows to create new
tty frames as we can create new X frames.
In terminal 1: emacs
In terminal 2: emacsclient --tty
You could also use: M-x make-frame-on-tty RET /dev/pts/NN RET xterm RET
But you'd need to ensure that your input in the xterm is not taken by
another program: run sleep 100000 for example!
xterm -display :0.0 -e bash -c 'ls -l /proc/$$/fd/;sleep 1000'
The advantage of multi-tty emacs is that you can have both X and
terminal frames.
You can also use screen, which would allow you to share terminals on
the same shell for any terminal application, including an emacs (even
a non multi-tty one):
screen -e^^^^ -d -m emacs -nw # to launch an emacs
screen -r -x # to attach to the session
screen -r -x # to attach to the session from another terminal.
(with emacs, it's useful to use C-^ as screen escape instead of the
default C-a).
You can try it with:
screen -e^^^^ -d -m emacs -nw
xterm -e screen -r -x &
xterm -e screen -r -x &
xterm -e screen -r -x &
The advantage of screen is that you can easily detach from the session
and having it go on with no terminal.
--
__Pascal Bourguignon__ http://www.informatimago.com/
ATTENTION: Despite any other listing of product contents found
herein, the consumer is advised that, in actuality, this product
consists of 99.9999999999% empty space.