all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Mark Laws <mdl@60hz.org>
Cc: 19688@debbugs.gnu.org
Subject: bug#19688: [patch] add support for emacs daemon on Windows
Date: Sun, 25 Jan 2015 22:34:10 +0200	[thread overview]
Message-ID: <83h9ver459.fsf@gnu.org> (raw)
In-Reply-To: <CADemMPPXYzgmvBLzAafpZiVUSvr1RULUAtaREZOP06m7s3ik9Q@mail.gmail.com>

> Date: Mon, 26 Jan 2015 04:18:34 +0900
> From: Mark Laws <mdl@60hz.org>
> 
> Attached is a patch which should apply cleanly on top of master
> (a3689d3c661fe36df971c875760f8d500b5ae994 as of this email). It allows
> Emacs to run as a daemon on Windows. Without daemon mode, emacsclient
> -a "" does not work, which makes it impossible to pass elisp to Emacs
> via emacsclient unless Emacs is already running. In other words, this
> will now work correctly:
> 
> emacsclient -a "" -e "(ediff-merge-files-with-ancestor ...)"

Thanks.

Did you get your paperwork with the FSF clerk done?  I don't see your
assignment on file yet.

> +#define W32_EMACS_SERVER_GUID "{0B8E5DCB-D7CF-4423-A9F1-2F6927F0D318}"

Where did this GUID come from?

In any case, instead of adding a one-line header file, it is better to
put this on nt/inc/ms-w32.h, which is included by both emacsclient.c
and all src/*.c files via src/config.h.

> +#ifndef WINDOWSNT
>  /* Pipe used to send exit notification to the daemon parent at
>     startup.  */
>  int daemon_pipe[2];
> +#else
> +bool w32_is_daemon;
> +bool w32_daemon_is_initialized;
> +static HANDLE w32_daemon_event;
> +#endif

Why do we need anything beyond the event handle?  Can't it serve
double duty as a flag as well?  We could use INVALID_HANDLE_VALUE
and/or NULL as distinct values with specific meanings.

> +#ifndef WINDOWSNT
>    /* Make sure IS_DAEMON starts up as false.  */
>    daemon_pipe[1] = 0;
> +#endif

You should do a similar initialization on WINDOWSNT, to avoid using
the value that was initialized when Emacs was dumped.

> +#ifdef WINDOWSNT
> +  daemon_check_preconditions ();
> +
> +  w32_daemon_event = CreateEvent (NULL, TRUE, FALSE, W32_EMACS_SERVER_GUID);
> +  if (w32_daemon_event == NULL)
> +    error ("Couldn't create event for Windows daemon");
> +  if (GetLastError () == ERROR_ALREADY_EXISTS)
> +    /* Signal the waiting emacsclient process.  */
> +    SetEvent (w32_daemon_event);
> +  CloseHandle (w32_daemon_event);
> +  w32_daemon_is_initialized = true;
> +#else

Please move this code to a function in w32.c, and here just call that
function.

Also, the call to daemon_check_preconditions should be outside of the
#ifdef, as it is used on all platforms.





  reply	other threads:[~2015-01-25 20:34 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-25 19:18 bug#19688: [patch] add support for emacs daemon on Windows Mark Laws
2015-01-25 20:34 ` Eli Zaretskii [this message]
     [not found]   ` <CADemMPM+Tix-6FJ+CO3HA8y7Cq6AV0kv_e6_qn7BaSw1QMOwTQ@mail.gmail.com>
2015-01-26  6:00     ` Eli Zaretskii
2015-01-26  7:40       ` Mark Laws
2015-01-26 11:56         ` Daniel Colascione
2015-01-27  8:40           ` Mark Laws
2015-01-30  0:36             ` Mark Laws
2015-01-30  6:28               ` Eli Zaretskii
2015-02-13  0:07                 ` Mark Laws
2015-02-13  8:49                   ` Eli Zaretskii
2015-02-14 12:10                     ` Eli Zaretskii
2015-02-14 13:16                       ` Mark Laws
2015-02-14 13:28                         ` Eli Zaretskii
2015-02-14 13:37                           ` Mark Laws
2015-02-14 15:24                             ` Eli Zaretskii
2015-02-14 16:34                               ` Mark Laws
2015-02-14 16:53                                 ` Eli Zaretskii
2015-02-14 16:57                                   ` Mark Laws
2015-02-14 17:23                                     ` Eli Zaretskii
2015-02-14 17:30                                       ` Mark Laws
2015-02-14 17:42                                         ` Eli Zaretskii
2015-02-14 17:57                                           ` Mark Laws
2015-02-14 18:26                                             ` Eli Zaretskii
2015-02-14 19:21                                               ` Mark Laws
2015-02-14 19:29                                                 ` Eli Zaretskii
2015-02-14 21:15                                                   ` Mark Laws
2015-02-19 16:31                                                     ` Mark Laws
2015-02-19 16:56                                                       ` Eli Zaretskii
2015-02-21 13:03                                                         ` Eli Zaretskii
2015-02-21 19:30                                                           ` Mark Laws
2015-02-27 14:26                                                             ` 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=83h9ver459.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=19688@debbugs.gnu.org \
    --cc=mdl@60hz.org \
    /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.