unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Tim X <timx@spamto.devnul.com>
Subject: Re: howto: 2 users interactively edit the same file ?
Date: 31 Oct 2005 19:04:16 +1100	[thread overview]
Message-ID: <8764reun7j.fsf@tiger.rapttech.com.au> (raw)
In-Reply-To: 87acgrsieb.fsf@thalassa.informatimago.com

Pascal Bourguignon <spam@mouse-potato.com> writes:

> 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.
> 

Hi Pascal,

Have you actually tried this? 

I find it amazing this will work. The big problem is how can emacs,
which doesn't support threads, handle simultaneous input from two
distinct frames? I can't see how it can handle input from two
different input devices simultaneously either. The physical displaying
of the frame on another display is easy enough to understand - this is
a feature of X windows which emacs is able to take advantage of when
it is built with X lib support - but coping with input from two
sources at the same time is a very different matter. 

I'm very much looking forward to seeing how this can be done and wish
I had a second computer handy so that I could experiment for
myself. I've redirected windows to remote displays before under X and
that works quite will - it will be interesting to see how emacs can
deal with the concurrency of two users. I hope the OP will keep us
informed as to progress.

BTW, the blocking nature of the minibuffer is a configuration setting
and can be disabled. There was a thread on this here a while back. 

,----[ C-h v enable-recursive-minibuffers RET ]
| enable-recursive-minibuffers's value is nil
| 
| Documentation:
| *Non-nil means to allow minibuffer commands while in the minibuffer.
| This variable makes a difference whenever the minibuffer window is active.
| 
| You can customize this variable.
`----

Setting this variable to t will allow minibuffers to be active within
minibuffers, effectively removing the default "blocking" behavior.

Tim

-- 
Tim Cross
The e-mail address on this message is FALSE (obviously!). My real e-mail is
to a company in Australia called rapttech and my login is tcross - if you 
really need to send mail, you should be able to work it out!

  parent reply	other threads:[~2005-10-31  8:04 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.12726.1130303098.20277.help-gnu-emacs@gnu.org>
2005-10-26  5:43 ` howto: 2 users interactively edit the same file ? PT
2005-10-26  6:08   ` Matt Carlson
2005-10-30  7:11   ` Tim X
2005-10-30  4:29 ` Tim X
2005-10-30  5:06   ` Pascal Bourguignon
2005-10-30  7:46     ` Bernard Adrian
     [not found]     ` <mailman.13285.1130658471.20277.help-gnu-emacs@gnu.org>
2005-10-30  8:33       ` Johan Bockgård
2005-10-30  8:47         ` Bernard Adrian
2005-10-31  7:38       ` Tim X
2005-10-31 18:06         ` Bernard Adrian
     [not found]         ` <mailman.13469.1130782270.20277.help-gnu-emacs@gnu.org>
2005-11-03  6:51           ` Tim X
2005-10-31  8:04     ` Tim X [this message]
2005-10-31 20:15       ` Eli Zaretskii
2005-10-31 21:48       ` kgold
2005-11-01  4:50         ` Matt Carlson
     [not found]       ` <mailman.13482.1130789736.20277.help-gnu-emacs@gnu.org>
2005-11-03  6:25         ` Tim X
2005-11-03  7:05           ` Pascal Bourguignon
2005-11-04 10:52           ` Eli Zaretskii
2005-10-26  5:04 Matt Carlson
2005-10-26  5:22 ` Neon Absentius

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8764reun7j.fsf@tiger.rapttech.com.au \
    --to=timx@spamto.devnul.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).