help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: howto: 2 users interactively edit the same file ?


From: Pascal Bourguignon
Subject: Re: howto: 2 users interactively edit the same file ?
Date: Sun, 30 Oct 2005 06:06:36 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

Tim X <timx@spamto.devnul.com> writes:

> Matt Carlson <mrcarlso@cs.purdue.edu> writes:
>
>> Hi all,
>>   I'm trying to figure out how to accomplish the following: My friend 
>> and I need to work with the same file at the same time.  It would be 
>> nice to be able to code simultaneously and see each others changes
>> in something like real time.  I've googled everywhere and found only
>> information on how emacs handles locks.. I'd like both he and I to 
>> be able to edit the same file and see each others changes as close to 
>> instantaneously as possible.
>> 
>>   The sky is the limit with emacs, so I'm sure there's a way to do this, 
>> I'm just in need of some direction as to how to do it, or even what 
>> words to google.
>> 
>>   It would be very nice to have a shell open in one buffer to chat 
>> with the other person editing the file, and then the file we're both
>> editing open in another.. Thanks in advance, 
>> 
>> -regards, 
>> Matt
>> 
>
> I would say fairly confidently, you have not a hope in hell of doing
> what you want. It is actaully very complicated to achieve multiple
> real-time editing of a document and emacs has none of the necessary
> infrastructure to achieve this. Issues which would need to be resolved
> (most non-trivial) include -
>
>     1. Emacs does its editing in buffers and changes are only written
>        to disk when you save the buffer. There is no way for two eamcs
>        instances to communicate information regarding buffer
>        contents. There is also no way to ensure one user doesn't save
>        the file and then have it over written by the second user when
>        they save the file.
>
>     2. Conflict resolution. If two users change the same section of
>        text at about the same time, which one will take precedence?
>
> In a way, what you want is a shared buffer which two separate emacs
> sessions can operate on at the same time. This would need shared
> memory with a coordination layer which would ensure both users have
> equal access to modifying the memory and some way of rsolving conflict
> and merging changes. Very difficult. 
>
> About the best you can do would be to use CVS to manage the
> files. Using CVS won't give you real-time, but it will simplify the
> merging of changes. You would have to ensure you both inform the other
> once you have made some changes and checked them into CVS. There will
> be times when CVS cannot resolve conflict - in these situations, you
> will have to work it out together.

Actually, it's quite easy to do, but indeed, not with two emacs
instances: with only one!

Just launch emacs, and use make-frame-on-display to open another X
window, on another workstation.  Then the two (or more, there's no
limit AFAIK on the number of frames you can open) users can edit the
same file in the same buffer at the same time.

Only the mini-buffer interaction is mutually exclusive: when a user
type M-x, the other is locked until the first validates or cancels the
command.

IIRC, this has already been mentionned in this thread.

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
Kitty like plastic.
Confuses for litter box.
Don't leave tarp around.


reply via email to

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