all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: David Kastrup <dak@gnu.org>
Cc: Juanma Barranquero <lekktu@gmail.com>,
	Nick Roberts <nickrob@snap.net.nz>,
	emacs-devel@gnu.org, Jason Rumney <jasonr@gnu.org>
Subject: Re: Pretest
Date: Mon, 20 Nov 2006 00:31:18 +0100	[thread overview]
Message-ID: <85lkm7814p.fsf@lola.goethe.zz> (raw)
In-Reply-To: <4560E279.9050700@student.lu.se> (Lennart Borgman's message of "Mon\, 20 Nov 2006 00\:02\:17 +0100")

Lennart Borgman <lennart.borgman.073@student.lu.se> writes:

> David Kastrup wrote:

>> You want to start an Emacs if it is not present, detach it so that
>> its life time does not depend on emacsserver, wait until it has
>> started a server (if it does so in the first place), then connect
>> to it, tell it what buffer to edit, and ask it to tell you when
>> this is done.
>>
>> I am proposing that instead one uses something like
>>
>> emacsclient -a "emacs -delayed-detach"
>>
>> where emacsclient does not actually have a clue that it has started
>> an Emacs, and does not try talking to it.  Instead it waits until
>> emacs dies.  What emacs does instead would, in Unixspeak, be to
>> fork.  The child would then detach itself from the controlling
>> terminal, take the command line options and start an almost normal
>> Emacs life.  When the user executed a "server-done", however, the
>> child would kill its parent which would then exit.
>
> But would not the fork used in this way mean that we during "waited
> editing" has two emacs processes (or more)? Would not that defeat
> some of the benefits of emacs server?

In Unix, fork is cheap.  The processes share the same code, and the
data starts out shared (the MMU sets it to read-only, and only when
one of the processes writes to it, a copy is created on which it then
works).  If the fork is done early in the life time of the process and
one of the forked processes touches only small amounts of data (which
would be the case here), the cost is negligible.  Similarly if after
the fork one of the processes does nothing much except change programs
by virtue of an exec call.

I am aware that Windows does not have fork with similar semantics,
which is why I then made a different proposal:

>> Now under Windows this forking stuff does not work IIRC.  Once one
>> starts a big process like Emacs, it is not cheap to start another copy
>> from inside.
>>
>> So instead of "emacs -delayed-detach" one would rather start something
>> like "emacsproxy" with the command line arguments.
>>
>> emacsproxy would then start the proper Emacs process with its command
>> line, and the proper Emacs process would, upon getting "server-done"
>> executed by the user, kill the emacsproxy process.
>>
>> So the invocation for emacsclient would be something like
>>
>>     emacsclient -a emacsproxy
>
> Thanks, I believe I understand this part, but it is quite a bit more
> complicated than what I actually have implemented.

It has the advantage that it does not need to wait around, does not
need to rely on "server-start" getting fired up eventually and so on.
It bypasses the complete emacsserver business, and thus would be a
_reliable_ way to start an Emacs that can stay around even when the
socket stuff fails to work for some reason (permissions, file names,
whatever).

In addition, it would provide a separate "start Emacs, and simulate
finishing it when the user wants so" command which could conceivably
be useful in situations outside of the emacsclient/emacsserver
setting.

> For what reason do you want to avoid the wait for the server process
> to start the way I have implemented it?

Because it is not reliable.  It depends on actions in the started
Emacs that are not under the control of emacsclient, and it requires a
separate mechanism not transparent to the user apart from
--alternate-editor.

> Doing it that way means that emacsclient always communicates with
> emacs server in the same way and I think that is very important from
> a code complexity point of view.

>From code complexity, emacsclient would just pass its options on to
the alternate editor, whether that is called emacsproxy or vi.

> One drawback I can see is that you can not know for sure if the
> server ever starts. Therefore I have added a simple timeout for how
> long emacsclient waits for emacs server to start.

I'd prefer the approach where emacsclient does not depend on Emacs
server to start.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

  reply	other threads:[~2006-11-19 23:31 UTC|newest]

Thread overview: 172+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-18 22:14 Pretest Chong Yidong
2006-11-18 22:58 ` Pretest Lennart Borgman
2006-11-18 23:32   ` Pretest Chong Yidong
2006-11-19  0:53     ` Pretest Juanma Barranquero
2006-11-19  0:56   ` Pretest Nick Roberts
2006-11-19  1:01     ` Pretest Juanma Barranquero
2006-11-19  1:56       ` Pretest Nick Roberts
2006-11-19  2:04         ` Pretest Juanma Barranquero
2006-11-19  3:29           ` Pretest Nick Roberts
2006-11-19  8:45     ` Pretest David Kastrup
2006-11-19 10:03       ` Pretest Nick Roberts
2006-11-19 10:18         ` Pretest David Kastrup
2006-11-19 11:44           ` Pretest Nick Roberts
2006-11-19 14:13             ` Pretest Juanma Barranquero
2006-11-19 14:24               ` Pretest David Kastrup
2006-11-19 14:42                 ` Pretest Juanma Barranquero
2006-11-19 14:45                 ` Pretest Lennart Borgman
2006-11-19 15:58                   ` Pretest David Kastrup
2006-11-19 19:13                     ` Pretest Lennart Borgman
2006-11-19 19:27                       ` Pretest David Kastrup
2006-11-20  1:15                         ` Pretest Stefan Monnier
2006-11-19 17:54                   ` Pretest Jason Rumney
2006-11-19 19:14                     ` Pretest Lennart Borgman
2006-11-19 19:50                     ` Pretest Jason Rumney
2006-11-19 20:48                       ` Pretest David Kastrup
2006-11-19 21:33                         ` Pretest Lennart Borgman
2006-11-19 21:33                         ` Pretest Jason Rumney
2006-11-19 21:49                           ` Pretest David Kastrup
2006-11-19 22:04                             ` Pretest Jason Rumney
2006-11-19 22:06                             ` Pretest Lennart Borgman
2006-11-19 22:44                               ` Pretest David Kastrup
2006-11-19 23:02                                 ` Pretest Lennart Borgman
2006-11-19 23:31                                   ` David Kastrup [this message]
2006-11-20  0:59                                     ` Pretest Lennart Borgman
2006-11-20  1:20                                       ` Pretest David Kastrup
     [not found]                                         ` <45616414.2080802@student.lu.se>
2006-11-20  9:55                                           ` Pretest David Kastrup
2006-11-20  1:20                             ` Pretest Stefan Monnier
2006-11-19 21:34                         ` Pretest Lennart Borgman
2006-11-19 21:38                         ` Pretest Lennart Borgman
2006-11-20 12:59               ` Pretest Richard Stallman
2006-11-19 14:19             ` Pretest Juanma Barranquero
2006-11-20  1:37           ` Pretest Richard Stallman
2006-11-20  3:00             ` Pretest Stefan Monnier
2006-11-20  9:01             ` Pretest Juanma Barranquero
2006-11-20  9:37               ` Pretest Jason Rumney
2006-11-20 10:06                 ` Pretest Juanma Barranquero
2006-11-20 10:50                   ` Pretest David Kastrup
2006-11-20 10:58                     ` Pretest Juanma Barranquero
2006-11-20 15:30                       ` Pretest Stefan Monnier
2006-11-20 16:48                         ` Pretest Juanma Barranquero
2006-11-20 10:01               ` Pretest David Kastrup
2006-11-20 23:58               ` Pretest Richard Stallman
2006-11-21  0:05                 ` Pretest Juanma Barranquero
2006-11-22 13:15                   ` Pretest Richard Stallman
2006-11-19 12:48 ` Pretest Richard Stallman
2006-11-19 20:08   ` Pretest Eli Zaretskii
2006-11-19 21:50   ` Pretest Reiner Steib
2006-11-20 12:59     ` Pretest Richard Stallman
2006-11-19 19:59 ` Pretest Eli Zaretskii
  -- strict thread matches above, loose matches on Subject: below --
2011-09-19 18:52 Pretest Chong Yidong
2011-09-19 21:13 ` Pretest Drew Adams
2011-09-20 15:27   ` Pretest Chong Yidong
2011-09-20 21:13     ` Pretest Andy Moreton
2011-09-20 21:33       ` Pretest Chong Yidong
2011-09-21  1:27     ` Pretest Stefan Monnier
2011-09-21  2:11       ` Pretest Drew Adams
2011-09-19 22:29 ` Pretest Lars Magne Ingebrigtsen
2011-09-20 15:27   ` Pretest Chong Yidong
2007-03-26  3:52 [david.reitter@gmail.com: file-remote-p malfunctions at site-start (file-name-handler-alist init)] Richard Stallman
2007-03-26  4:40 ` Chong Yidong
2007-03-26 13:14   ` Stefan Monnier
2007-03-26 13:37     ` Michael Albinus
2007-03-26 14:16       ` Chong Yidong
2007-03-26 14:44         ` Michael Albinus
2007-03-27 20:59           ` Chong Yidong
2007-03-31 18:47             ` Michael Albinus
2007-03-31 19:41               ` David Kastrup
2007-03-31 20:02                 ` Pretest Chong Yidong
2007-03-18  4:28 Pretest Chong Yidong
2007-03-18  4:31 ` Pretest Juanma Barranquero
2007-03-20  1:34 ` Pretest Chong Yidong
2007-03-20  2:05   ` Pretest Juanma Barranquero
2007-03-20  4:40   ` Pretest dhruva
2007-03-20 12:07     ` Pretest AriT93
2007-03-20 12:36       ` Pretest dhruva
2007-03-20 13:14         ` Pretest AriT93
2007-03-21 22:47   ` Pretest Lennart Borgman (gmail)
2007-03-09 17:46 Killing buffers with mouse Eli Zaretskii
2007-03-20 13:04 ` Pretest Angelo Graziosi
2006-11-07 20:13 Pretest Nick Roberts
2006-11-07 22:48 ` Pretest Miles Bader
2006-11-08  1:17   ` Pretest Nick Roberts
2006-11-08  1:41     ` Pretest Miles Bader
2006-10-28 20:33 Pretest Mikko Huhtala
2006-10-27 17:59 Pretest Chong Yidong
2006-10-27 18:52 ` Pretest Paul Pogonyshev
2006-10-27 19:12 ` Pretest David Hansen
2006-10-28 11:31   ` Pretest Eli Zaretskii
2006-11-15 21:35     ` Pretest Reiner Steib
2006-11-15 22:51       ` Pretest Nick Roberts
2006-10-27 19:38 ` Pretest Kim F. Storm
2006-10-28 11:17   ` Pretest Eli Zaretskii
2006-10-29 18:45     ` Pretest Richard Stallman
2006-10-29 20:20       ` Pretest Eli Zaretskii
2006-10-27 20:01 ` Pretest joakim
2006-10-27 21:11 ` Pretest Giorgos Keramidas
2006-10-28  2:30 ` Pretest Andrew M. Scott
2006-10-28  8:11 ` Pretest Yoni Rabkin Katzenell
2006-10-28  8:46 ` Pretest Andreas Roehler
2006-10-28 11:01 ` Pretest Jason Rumney
2006-10-28 13:14   ` Pretest Eli Zaretskii
2006-10-28 21:47     ` Pretest Jason Rumney
2006-10-29  4:30       ` Pretest Eli Zaretskii
2006-10-29 11:17         ` Pretest Jason Rumney
2006-10-29 11:47           ` Pretest Eli Zaretskii
2006-10-30 13:33             ` Pretest Richard Stallman
2006-10-30 21:12               ` Pretest Eli Zaretskii
2006-11-01  2:12                 ` Pretest Richard Stallman
2006-11-04 12:15           ` Pretest Eli Zaretskii
2006-11-04 22:23             ` Pretest Jason Rumney
2006-11-05  6:15               ` Pretest Eli Zaretskii
2006-11-05 12:39                 ` Pretest Jason Rumney
2006-11-05 12:41                 ` Pretest Jason Rumney
2006-10-28 11:13 ` Pretest Eli Zaretskii
2006-10-28 13:30 ` Pretest Benjamin Riefenstahl
2006-10-28 15:25   ` Pretest Chong Yidong
2006-10-28 13:38 ` Pretest Eli Zaretskii
2006-10-28 15:53   ` Pretest Chong Yidong
2006-10-28 19:05     ` Pretest Eli Zaretskii
2006-10-29 21:36       ` Pretest Chong Yidong
2006-10-30  4:25         ` Pretest Eli Zaretskii
2006-10-30 14:21           ` Pretest Chong Yidong
2006-10-28 14:28 ` Pretest Eli Zaretskii
2006-10-28 15:01   ` Pretest Chong Yidong
2006-10-28 19:28     ` Pretest Eli Zaretskii
2006-10-28 20:47       ` Pretest Chong Yidong
2006-10-29  7:43         ` Pretest Eli Zaretskii
2006-10-29 22:11           ` Pretest Chong Yidong
2006-10-30 21:50             ` Pretest Eli Zaretskii
2006-10-30 22:04               ` Pretest Chong Yidong
2006-10-31  4:09                 ` Pretest Eli Zaretskii
2006-10-30 13:33           ` Pretest Richard Stallman
2006-10-30 21:02             ` Pretest Eli Zaretskii
2006-11-01  2:12               ` Pretest Richard Stallman
2006-11-01  4:14                 ` Pretest Eli Zaretskii
2006-11-02  4:42                   ` Pretest Richard Stallman
2006-11-02 19:54                     ` Pretest Eli Zaretskii
2006-11-03  7:08                       ` Pretest Richard Stallman
2006-11-04 13:50                         ` Pretest Eli Zaretskii
2006-11-05  7:08                           ` Pretest Richard Stallman
     [not found] ` <cyd@stupidchicken.com>
2006-10-28 15:08   ` Pretest Alfred M. Szmidt
2006-10-28 20:52     ` Pretest Chong Yidong
2006-10-28 21:11       ` Pretest Alfred M. Szmidt
2006-10-28 22:09         ` Pretest Chong Yidong
2006-10-28 22:30           ` Pretest Alfred M. Szmidt
2006-10-29 23:40             ` Pretest Chong Yidong
2006-10-30  0:33               ` Pretest Alfred M. Szmidt
2006-10-30 14:12                 ` Pretest Chong Yidong
2006-10-30 19:57                   ` Pretest Alfred M. Szmidt
2006-10-30 20:18                     ` Pretest Chong Yidong
2006-10-30 20:34                       ` Pretest Alfred M. Szmidt
2006-10-30 22:18                         ` Pretest Chong Yidong
2006-10-30 23:00                           ` Pretest Alfred M. Szmidt
2006-11-01  2:12                         ` Pretest Richard Stallman
2006-11-02 14:10                           ` Pretest Alfred M. Szmidt
2006-10-28 18:13 ` Pretest Richard Stallman
2006-10-28 19:02   ` Pretest Eli Zaretskii
2006-10-29 18:49     ` Pretest Richard Stallman
2006-10-29 20:22       ` Pretest Eli Zaretskii
2006-10-30 19:16         ` Pretest Richard Stallman
2006-11-03 15:39   ` Pretest Drew Adams
2006-11-03 19:22     ` Pretest Eli Zaretskii
2006-11-03 19:51       ` Pretest Lennart Borgman
2006-11-03 20:02         ` Pretest Eli Zaretskii
2006-11-03 20:48     ` Pretest Nick Roberts
2006-11-04 15:26     ` Pretest Richard Stallman
2006-10-30 20:04 ` Pretest Paul Jarc
2006-10-30 23:13   ` Pretest Chong Yidong
2006-10-31  9:44 ` Pretest Jim Thompson
2006-11-05 23:30 ` Pretest Bill Wohler
2006-11-06  0:01   ` Pretest Jason Rumney
2006-11-06  4:22   ` Pretest Eli Zaretskii

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

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

  git send-email \
    --in-reply-to=85lkm7814p.fsf@lola.goethe.zz \
    --to=dak@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=jasonr@gnu.org \
    --cc=lekktu@gmail.com \
    --cc=nickrob@snap.net.nz \
    /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.
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.