all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* howto: 2 users interactively edit the same file ?
@ 2005-10-26  5:04 Matt Carlson
  2005-10-26  5:22 ` Neon Absentius
  0 siblings, 1 reply; 20+ messages in thread
From: Matt Carlson @ 2005-10-26  5:04 UTC (permalink / raw)


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

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: howto: 2 users interactively edit the same file ?
  2005-10-26  5:04 Matt Carlson
@ 2005-10-26  5:22 ` Neon Absentius
  0 siblings, 0 replies; 20+ messages in thread
From: Neon Absentius @ 2005-10-26  5:22 UTC (permalink / raw)


On Wed, Oct 26, 2005 at 12:04:50AM -0500, Matt Carlson wrote:
> 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, 
> 

One idea is to run emacs inside a GNU screen.
Or you might try the multi-tty branch, have a look here

http://lorentey.hu/project/emacs.html.en

HTH 
-- 
Computer science is not about computers, any more than astronomy is
about telescopes.
        -- Edsger Dijkstra

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: howto: 2 users interactively edit the same file ?
       [not found] <mailman.12726.1130303098.20277.help-gnu-emacs@gnu.org>
@ 2005-10-26  5:43 ` PT
  2005-10-26  6:08   ` Matt Carlson
  2005-10-30  7:11   ` Tim X
  2005-10-30  4:29 ` Tim X
  1 sibling, 2 replies; 20+ messages in thread
From: PT @ 2005-10-26  5:43 UTC (permalink / raw)


After years of using Emacs I accidentally discovered M-x
make-frame-on-display which can do what you want if memory serves me
right.

I don't know if it works on Windows, but it was seamless on Unix.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: howto: 2 users interactively edit the same file ?
  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
  1 sibling, 0 replies; 20+ messages in thread
From: Matt Carlson @ 2005-10-26  6:08 UTC (permalink / raw)


* PT (spamfilteraccount@gmail.com) wrote:
> After years of using Emacs I accidentally discovered M-x
> make-frame-on-display which can do what you want if memory serves me
> right.
> 
Thank you.  I actually just stumbled upon this myself.  I've got it 
working with myself, now I just have to figure out the xauth issues
between my friend and I.. 

In regards to that: I should just be able to "xauth extract file $DISPLAY" 
and then give that "file" to my friend and he can "xauth merge file" ..

Naively that didn't work-- so I keep digging, 

Thanks again,
Matt

> I don't know if it works on Windows, but it was seamless on Unix.
> 
> _______________________________________________
> Help-gnu-emacs mailing list
> Help-gnu-emacs@gnu.org
> http://lists.gnu.org/mailman/listinfo/help-gnu-emacs

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: howto: 2 users interactively edit the same file ?
       [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-30  4:29 ` Tim X
  2005-10-30  5:06   ` Pascal Bourguignon
  1 sibling, 1 reply; 20+ messages in thread
From: Tim X @ 2005-10-30  4:29 UTC (permalink / raw)


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.

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!

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: howto: 2 users interactively edit the same file ?
  2005-10-30  4:29 ` Tim X
@ 2005-10-30  5:06   ` Pascal Bourguignon
  2005-10-30  7:46     ` Bernard Adrian
                       ` (2 more replies)
  0 siblings, 3 replies; 20+ messages in thread
From: Pascal Bourguignon @ 2005-10-30  5:06 UTC (permalink / raw)


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.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: howto: 2 users interactively edit the same file ?
  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
  1 sibling, 0 replies; 20+ messages in thread
From: Tim X @ 2005-10-30  7:11 UTC (permalink / raw)


"PT" <spamfilteraccount@gmail.com> writes:

> After years of using Emacs I accidentally discovered M-x
> make-frame-on-display which can do what you want if memory serves me
> right.
> 
> I don't know if it works on Windows, but it was seamless on Unix.
> 

I don't think this will work. The problem will be getting input. I
suspect that as this would involve redirecting a frame from an
existing emacs session to a different display, while the second user
would be able to see the frame, they would not be able to input data
as the application itself is still associated with the input from the
user who started the session. 

It would probably be possible to start emacs and have all its i/o
directed to the second display, but then the first user who started
emacs won't have any way to input commands/characters etc. 

I think the root of the problem here is that the OP wants to be able
to setup emacs in such a way that two users can be usinig it at the
same time - it simply is not designed to achieve this - don't forget
emacs doesn't have thread support either, so I doubt you could even
modify emacs itself to achieve this. 

The best you could do wold be -

    1. Use CVS as the repository for the files
    2. Each user checks out their own copy 
    3. Each user starts emacs and opens their own copy
    4. Each user creates a second frame with a copy of the file they
    are editing and redirects this frame to the other users display
    5. Each user checks in their document once editing has finished. 

The two users would be editing *different* copies of the file and
there would still be a need to merge them together, but CVS will take
care of the trivial merging problems. The two users will have to
resolve more complex merges. The redirected frame would at least allow
each user to see what the other has done - but I suspect the
functionality here will be limited as I don't think the second user
will be able to manipulate the contents of the window i.e. scroll
up/down etc. 
-- 
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!

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: howto: 2 users interactively edit the same file ?
  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-31  8:04     ` Tim X
  2 siblings, 0 replies; 20+ messages in thread
From: Bernard Adrian @ 2005-10-30  7:46 UTC (permalink / raw)


Pascal Bourguignon <spam@mouse-potato.com> a écrit : 

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

Hi,

I'm trying to use make-frame-on-display from an emacs running in a
tty. I tried : make-frame-on-display ENTER :0.0

Nothing happens on X, where $DISPLAY is :0.0, though.

I was hoping to get an error log on the Messages Buffer, but i got no
such message. 

Do you think :
- emacs can't make a frame on X from a tty ?
- my window manager (ion3) can't accept this feature ? 
- I did a mistake ?

Thanks
-- 
Bernard Adrian 
http://bernadrian.free.fr

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: howto: 2 users interactively edit the same file ?
       [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
  1 sibling, 1 reply; 20+ messages in thread
From: Johan Bockgård @ 2005-10-30  8:33 UTC (permalink / raw)


Bernard Adrian <bernadrian@free.fr> writes:

> - emacs can't make a frame on X from a tty ?

Correct.

This feature is being implemented, though. See
http://lorentey.hu/project/emacs.html

Also, XEmacs already supports this.

-- 
Johan Bockgård

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: howto: 2 users interactively edit the same file ?
  2005-10-30  8:33       ` Johan Bockgård
@ 2005-10-30  8:47         ` Bernard Adrian
  0 siblings, 0 replies; 20+ messages in thread
From: Bernard Adrian @ 2005-10-30  8:47 UTC (permalink / raw)


bojohan+news@dd.chalmers.se (Johan Bockgård) a écrit : 

>> - emacs can't make a frame on X from a tty ?
>
> Correct.
>
> This feature is being implemented, though. See
> http://lorentey.hu/project/emacs.html
>
> Also, XEmacs already supports this.

Thanks, Johan
-- 
Bernard Adrian 
http://bernadrian.free.fr

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: howto: 2 users interactively edit the same file ?
       [not found]     ` <mailman.13285.1130658471.20277.help-gnu-emacs@gnu.org>
  2005-10-30  8:33       ` Johan Bockgård
@ 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>
  1 sibling, 2 replies; 20+ messages in thread
From: Tim X @ 2005-10-31  7:38 UTC (permalink / raw)


Bernard Adrian <bernadrian@free.fr> writes:

> Pascal Bourguignon <spam@mouse-potato.com> a écrit : 
> 
> > 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.
> 
> Hi,
> 
> I'm trying to use make-frame-on-display from an emacs running in a
> tty. I tried : make-frame-on-display ENTER :0.0
> 
> Nothing happens on X, where $DISPLAY is :0.0, though.
> 
> I was hoping to get an error log on the Messages Buffer, but i got no
> such message. 
> 
> Do you think :
> - emacs can't make a frame on X from a tty ?
> - my window manager (ion3) can't accept this feature ? 
> - I did a mistake ?
> 
> Thanks
> -- 
> Bernard Adrian 
> http://bernadrian.free.fr
> 

Its unlikely it can be done from a tty - I don't think emacs will be
loading the X libraries (needed to open an X display).

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!

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: howto: 2 users interactively edit the same file ?
  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-31  8:04     ` Tim X
  2005-10-31 20:15       ` Eli Zaretskii
                         ` (2 more replies)
  2 siblings, 3 replies; 20+ messages in thread
From: Tim X @ 2005-10-31  8:04 UTC (permalink / raw)


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!

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: howto: 2 users interactively edit the same file ?
  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>
  1 sibling, 0 replies; 20+ messages in thread
From: Bernard Adrian @ 2005-10-31 18:06 UTC (permalink / raw)


Tim X <timx@spamto.devnul.com> a écrit : 

>> Do you think :
>> - emacs can't make a frame on X from a tty ?
>> - my window manager (ion3) can't accept this feature ? 
>> - I did a mistake ?
>
> Its unlikely it can be done from a tty - I don't think emacs will be
> loading the X libraries (needed to open an X display).

I decided to use emacs-multi-tty. Works fine. I had tried it before
but i was wondering if it was a good idea to remove emacs21. Hoping a
new version of the official GNU/Emacs will soon allow us to use the
multi-tty feature.

What is amazing, on my mind, is that it is possible to launch emacs21
from a tty on a X window (emacs -display=:0.0), but not possible to
create a frame on a X window from an emacs21 running in a tty...

-- 
Bernard Adrian 
http://bernadrian.free.fr

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: howto: 2 users interactively edit the same file ?
  2005-10-31  8:04     ` Tim X
@ 2005-10-31 20:15       ` Eli Zaretskii
  2005-10-31 21:48       ` kgold
       [not found]       ` <mailman.13482.1130789736.20277.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 20+ messages in thread
From: Eli Zaretskii @ 2005-10-31 20:15 UTC (permalink / raw)


> From: Tim X <timx@spamto.devnul.com>
> Date: 31 Oct 2005 19:04:16 +1100
> 
> 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.

I don't see why you cannot see that: quite simply, Emacs tries to read
from every possible input source, one after the other (that includes
any subprocesses that happen to run in some Emacs buffers, such as
compilation, Grep, spell-checker, etc.).  Emacs uses the system call
`select' or its equivalent to do that; `select' actually allows you to
set up a kind of ``poor man's threading'' in a single thread.

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

Not really.  Provided that you know what source each input even came
from, it's quite easy to DTRT with each one of them.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: howto: 2 users interactively edit the same file ?
  2005-10-31  8:04     ` Tim X
  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>
  2 siblings, 1 reply; 20+ messages in thread
From: kgold @ 2005-10-31 21:48 UTC (permalink / raw)


Tim X <timx@spamto.devnul.com> writes:
> 
> 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.

I just tried it again - works fine.  I used to do this all the time
for instant messaging sessions before IM was invented.

One machine was a pSeries running AIX and another was a Thinkpad
running Linux.

Warning: There is an obvious security issue, as the frame recipient
can start a shell and become you.  So you have to trust your partner.

-- 
Ken Goldman   kgold@watson.ibm.com   914-784-7646

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: howto: 2 users interactively edit the same file ?
  2005-10-31 21:48       ` kgold
@ 2005-11-01  4:50         ` Matt Carlson
  0 siblings, 0 replies; 20+ messages in thread
From: Matt Carlson @ 2005-11-01  4:50 UTC (permalink / raw)


* kgold (kgold@watson.ibm.com) wrote:
> Tim X <timx@spamto.devnul.com> writes:
> > 
> > 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.
> 
> I just tried it again - works fine.  I used to do this all the time
> for instant messaging sessions before IM was invented.
> 
> One machine was a pSeries running AIX and another was a Thinkpad
> running Linux.
> 
> Warning: There is an obvious security issue, as the frame recipient
> can start a shell and become you.  So you have to trust your partner.

Excellent point.

We've now got everything working just as I'd hoped.  After
finding out about make-frame-on-display (and frames in general)
it was really pretty simple.  Actually, the xauth stuff took more 
fussing than did emacs.  But-- it's working perfectly now.

Thanks to all of you for your help.

-regards, 
Matt

> 
> -- 
> Ken Goldman   kgold@watson.ibm.com   914-784-7646
> _______________________________________________
> Help-gnu-emacs mailing list
> Help-gnu-emacs@gnu.org
> http://lists.gnu.org/mailman/listinfo/help-gnu-emacs

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: howto: 2 users interactively edit the same file ?
       [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
  0 siblings, 2 replies; 20+ messages in thread
From: Tim X @ 2005-11-03  6:25 UTC (permalink / raw)


Eli Zaretskii <eliz@gnu.org> writes:

> > From: Tim X <timx@spamto.devnul.com>
> > Date: 31 Oct 2005 19:04:16 +1100
> > 
> > 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.
> 
> I don't see why you cannot see that: quite simply, Emacs tries to read
> from every possible input source, one after the other (that includes
> any subprocesses that happen to run in some Emacs buffers, such as
> compilation, Grep, spell-checker, etc.).  Emacs uses the system call
> `select' or its equivalent to do that; `select' actually allows you to
> set up a kind of ``poor man's threading'' in a single thread.
> 
> > 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. 
> 
> Not really.  Provided that you know what source each input even came
> from, it's quite easy to DTRT with each one of them.

OK, I'm quite willing to accept all of that, though I'd still have
concerns about how performance would be. If I understand you
corrrectly, wouldn't there be a high likelihood of one input source
"hogging" things - effectively causing a sort of starvation for the
other user? There doesn't seem to be any sense of "fair" access in the
model your describing and I still feel this would be problematic.

I also wonder how emacs will handle things like local variables when
you have two different users editing in the same buffer. Wouldn't this
have consequences for things like point and region related commands?

I guess I'm over stating the complexities or something as the weight
of opinion is against me. I have no problem with that, but my past
experiences working on systems which have a similar model of operation
where two users are affecting the same resource concurrently tells me
its not as simple as just opening a second window on another display
and everything else will just sort of magically work - I guess its my
gut telling me there is a lot more too it and its a lot more complex -
no real specific proof of this though.

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!

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: howto: 2 users interactively edit the same file ?
       [not found]         ` <mailman.13469.1130782270.20277.help-gnu-emacs@gnu.org>
@ 2005-11-03  6:51           ` Tim X
  0 siblings, 0 replies; 20+ messages in thread
From: Tim X @ 2005-11-03  6:51 UTC (permalink / raw)


Bernard Adrian <bernadrian@free.fr> writes:

> Tim X <timx@spamto.devnul.com> a écrit : 
> 
> >> Do you think :
> >> - emacs can't make a frame on X from a tty ?
> >> - my window manager (ion3) can't accept this feature ? 
> >> - I did a mistake ?
> >
> > Its unlikely it can be done from a tty - I don't think emacs will be
> > loading the X libraries (needed to open an X display).
> 
> I decided to use emacs-multi-tty. Works fine. I had tried it before
> but i was wondering if it was a good idea to remove emacs21. Hoping a
> new version of the official GNU/Emacs will soon allow us to use the
> multi-tty feature.
> 
> What is amazing, on my mind, is that it is possible to launch emacs21
> from a tty on a X window (emacs -display=:0.0), but not possible to
> create a frame on a X window from an emacs21 running in a tty...
> 
> -- 
> Bernard Adrian 
> http://bernadrian.free.fr
> 
The ability of X to redirect i/o to a different display on a different
machine is probably one of the main advantages of X that I've always
loved. We were doing this stuff back in the late 80's when MS still
only had DOS!

I don't know exactly why you can't take advantage of X support when
running under a console tty, but suspect emacs may be being a little
too smart and just doesn't load any X related libraries etc if it
detects your running in console mode.

With respect to your reference to the hassles of getting the xauth
stuff right, there use to be a script which came with the X
distribution called Xon, which used rsh to automate the merging of
xauth cookies. While I've not used this since switching to ssh for
remote access (which handles all the X stuff automatically), you might
want to check to see if that script exists on your system. Its trivial
to modify it to use scp to merge the xauth cookies.

I'm glad to see you got it working. I really didn't think it would be
that easy and expected you would see either really poor performance
due to contention over shared resources etc or weird side
effects. I've obviously under estimated the design of emacs!

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!

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: howto: 2 users interactively edit the same file ?
  2005-11-03  6:25         ` Tim X
@ 2005-11-03  7:05           ` Pascal Bourguignon
  2005-11-04 10:52           ` Eli Zaretskii
  1 sibling, 0 replies; 20+ messages in thread
From: Pascal Bourguignon @ 2005-11-03  7:05 UTC (permalink / raw)


Tim X <timx@spamto.devnul.com> writes:
> OK, I'm quite willing to accept all of that, though I'd still have
> concerns about how performance would be. If I understand you
> corrrectly, wouldn't there be a high likelihood of one input source
> "hogging" things - effectively causing a sort of starvation for the
> other user? There doesn't seem to be any sense of "fair" access in the
> model your describing and I still feel this would be problematic.

Indeed.  What's more, emacs imposes a "mutex" on the mini-buffer.  If
you type M-x in one frame, you cannot do anything else on the other
frame before you cancel the M-x or complete a command.


> I also wonder how emacs will handle things like local variables when
> you have two different users editing in the same buffer. Wouldn't this
> have consequences for things like point and region related commands?

point and region are frame local, not buffer local.


> I guess I'm over stating the complexities or something as the weight
> of opinion is against me. I have no problem with that, but my past
> experiences working on systems which have a similar model of operation
> where two users are affecting the same resource concurrently tells me
> its not as simple as just opening a second window on another display
> and everything else will just sort of magically work - I guess its my
> gut telling me there is a lot more too it and its a lot more complex -
> no real specific proof of this though.

Since there's no multithreading, there's no problem of accessing the
same resources concurrently.  It works exactly the same way with frame
on different display and several pointers & keyboards on different
displays than with several pointers & keyboards on the _same_ display,
or even one pointer & keyboard on one display with several frames: you
cannot type a key into two frames at the same "time": it'd produce two
distinct and ordered events and they're processed one after the other,
so there's no problem.

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
Small brave carnivores
Kill pine cones and mosquitoes
Fear vacuum cleaner

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: howto: 2 users interactively edit the same file ?
  2005-11-03  6:25         ` Tim X
  2005-11-03  7:05           ` Pascal Bourguignon
@ 2005-11-04 10:52           ` Eli Zaretskii
  1 sibling, 0 replies; 20+ messages in thread
From: Eli Zaretskii @ 2005-11-04 10:52 UTC (permalink / raw)


> From: Tim X <timx@spamto.devnul.com>
> Date: 03 Nov 2005 17:25:54 +1100
> 
> OK, I'm quite willing to accept all of that, though I'd still have
> concerns about how performance would be. If I understand you
> corrrectly, wouldn't there be a high likelihood of one input source
> "hogging" things - effectively causing a sort of starvation for the
> other user? There doesn't seem to be any sense of "fair" access in the
> model your describing and I still feel this would be problematic.

It's a round-robin model: whenever some input is found pending, Emacs
retrieves it and processes it, then it goes to see if there's any more
input.  If the input event invokes some expensive processing, the next
event will not be processed until the expensive part is done.  There's
no preemption.

So yes, it could be that one user hogs Emacs and starves the other,
but only for the duration of processing of a single input event (e.g.,
a single keypress or one mouse event).  However, this can happen even
with a single user: you type something that starts a prolonged
operation, then the rest of your input waits in the queue until the
prolonged operation is done.

> I also wonder how emacs will handle things like local variables when
> you have two different users editing in the same buffer. Wouldn't this
> have consequences for things like point and region related commands?

Yes.  But two users using the same Emacs are not supposed to be
fighting each other, they're supposed to cooperate ;-)

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2005-11-04 10:52 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [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
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

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.