Subject: bug#72345: 29.4; Emacs daemon on Windows OS

From: Eli Zaretskii <[email-masked]>
Date: Mon, 29 Jul 2024 15:12:58 +0300

> From: Constantin Kulikov <[email-masked]>
> Date: Mon, 29 Jul 2024 12:28:08 +0300
> 
> I found the root of the problem. The horrors I described in starting post happens only if you specify custom
> command line parameters in emacs --daemon command, like:
> 
> ```
> # emacs.exe --daemon -myparam test
> ```
> 
> Which can be used in a config like:
> 
> ```
> (let ((myparamcons (member "-myparam" command-line-args)))
>     (setq myparam (cadr myparamcons)))
> ```
> 
> If you specify such a command line argument then the server file is not created by default and if you manually
> (server-start) from your config then emacs read-* functions are trying to read input from the terminal. But
> interestingly that if you press C-x C-c in emacsclient frame -- then emacs request to save modified files are
> handled properly in GUI frame.
> 
> So the "solution" is not to specify any custom command line arguments.
> I consider it as a bug.

I can reproduce this in Emacs 29, but not on the current emacs-30
release branch, which will eventually become Emacs 30.1.  Emacs 30
refuses to start in this case:

  d:\>emacs --daemon -Q -myparam test
  Starting Emacs daemon.
  Unknown option `-myparam'

  d:\>echo %ERRORLEVEL%
  -1

and after the above, I see no Emacs process running, so it exited with
status -1 after reporting the error.

Thus, I guess we already fixed this bug.