GNU bug report logs - #1298
allow 'emacsclient -a "emacs --daemon && emacsclient -c"'

Previous Next

Package: emacs;

Reported by: Dan Nicolaescu <dann <at> ics.uci.edu>

Date: Sun, 2 Nov 2008 18:25:04 UTC

Severity: wishlist

Done: Dan Nicolaescu <dann <at> ics.uci.edu>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 1298 in the body.
You can then email your comments to 1298 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1298; Package emacs. Full text and rfc822 format available.

Message #3 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Dan Nicolaescu <dann <at> ics.uci.edu>
To: bug-gnu-emacs <bug-gnu-emacs <at> gnu.org>
Subject: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
Date: Sun, 2 Nov 2008 10:18:15 -0800 (PST)
It would be nice if some equivalent of: 

'emacsclient -a "emacs --daemon && emacsclient -c"

would work.

That would allow one to ALWAYS use emacsclient. 





Severity set to `wishlist' from `normal' Request was from Chong Yidong <cyd <at> stupidchicken.com> to control <at> emacsbugs.donarmstrong.com. (Mon, 03 Nov 2008 02:35:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1298; Package emacs. Full text and rfc822 format available.

Message #8 received at 1298 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Dan Nicolaescu <dann <at> ics.uci.edu>
To: 1298 <at> debbugs.gnu.org
Subject: Re: bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
Date: Tue, 18 Nov 2008 00:22:33 -0800 (PST)
Dan Nicolaescu <dann <at> ics.uci.edu> writes:

  > It would be nice if some equivalent of: 
  > 
  > 'emacsclient -a "emacs --daemon && emacsclient -c"
  > 
  > would work.
  > 
  > That would allow one to ALWAYS use emacsclient. 

Here's a quick hack that allows:

emacsclient -a "emacs --daemon && emacsclient -c" FILENAME

to work.  It is not complete yet, FILENAME does not get passed to the
"&& emacsclient"


--- emacsclient.c.~1.140.~	2008-11-03 06:30:13.000000000 -0800
+++ emacsclient.c	2008-11-18 00:13:29.000000000 -0800
@@ -630,8 +630,13 @@ fail (void)
   if (alternate_editor)
     {
       int i = optind - 1;
+      char * new_argv[] = { "sh", "-c", 0, 0 };
 
-      execvp (alternate_editor, main_argv + i);
+      new_argv[0] = "sh";
+      new_argv[1] = "-c";
+      new_argv[2] = alternate_editor;
+
+      execve ("/bin/sh", new_argv, environ);
       message (TRUE, "%s: error executing alternate editor \"%s\"\n",
 	       progname, alternate_editor);
     }


Thoughts?




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1298; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Stefan Monnier <monnier <at> IRO.UMontreal.CA>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #13 received at 1298 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Dan Nicolaescu <dann <at> ics.uci.edu>
Cc: 1298 <at> debbugs.gnu.org
Subject: Re: bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
Date: Tue, 18 Nov 2008 11:36:43 -0500
>> It would be nice if some equivalent of: 
>> 'emacsclient -a "emacs --daemon && emacsclient -c"
>> would work.
>> That would allow one to ALWAYS use emacsclient. 

> Here's a quick hack that allows:
> emacsclient -a "emacs --daemon && emacsclient -c" FILENAME
> to work.  It is not complete yet, FILENAME does not get passed to the
> "&& emacsclient"

Here's an alternative:

   [ "$(emacsclient -e "'up" 2>/dev/null)" = "up" ] || emacs --daemon
   emacsclient -c FILENAME


-- Stefan




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1298; Package emacs. Full text and rfc822 format available.

Message #16 received at 1298 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Dan Nicolaescu <dann <at> ics.uci.edu>
To: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Cc: 1298 <at> debbugs.gnu.org
Subject: Re: bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
Date: Tue, 18 Nov 2008 10:17:43 -0800 (PST)
Stefan Monnier <monnier <at> IRO.UMontreal.CA> writes:

  > >> It would be nice if some equivalent of: 
  > >> 'emacsclient -a "emacs --daemon && emacsclient -c"
  > >> would work.
  > >> That would allow one to ALWAYS use emacsclient. 
  > 
  > > Here's a quick hack that allows:
  > > emacsclient -a "emacs --daemon && emacsclient -c" FILENAME
  > > to work.  It is not complete yet, FILENAME does not get passed to the
  > > "&& emacsclient"
  > 
  > Here's an alternative:
  > 
  >    [ "$(emacsclient -e "'up" 2>/dev/null)" = "up" ] || emacs --daemon
  >    emacsclient -c FILENAME

I've been using something similar for a long time (even before
--daemon), but it seems that it's more elegant to use a single command
that shell hackery...




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1298; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Eli Zaretskii <eliz <at> gnu.org>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #21 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Dan Nicolaescu <dann <at> ics.uci.edu>, 1298 <at> debbugs.gnu.org
Cc: 1298 <at> debbugs.gnu.org, bug-submit-list <at> donarmstrong.com,
        bug-gnu-emacs <at> gnu.org
Subject: Re: bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
Date: Tue, 18 Nov 2008 21:43:13 +0200
> Date: Tue, 18 Nov 2008 00:22:33 -0800 (PST)
> From: Dan Nicolaescu <dann <at> ics.uci.edu>
> Cc: 
> 
> --- emacsclient.c.~1.140.~	2008-11-03 06:30:13.000000000 -0800
> +++ emacsclient.c	2008-11-18 00:13:29.000000000 -0800
> @@ -630,8 +630,13 @@ fail (void)
>    if (alternate_editor)
>      {
>        int i = optind - 1;
> +      char * new_argv[] = { "sh", "-c", 0, 0 };
>  
> -      execvp (alternate_editor, main_argv + i);
> +      new_argv[0] = "sh";
> +      new_argv[1] = "-c";
> +      new_argv[2] = alternate_editor;
> +
> +      execve ("/bin/sh", new_argv, environ);
>        message (TRUE, "%s: error executing alternate editor \"%s\"\n",
>  	       progname, alternate_editor);
>      }
> 
> 
> Thoughts?

Won't work on platforms that don't have /bin/sh.





Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1298; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Eli Zaretskii <eliz <at> gnu.org>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1298; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Stefan Monnier <monnier <at> IRO.UMontreal.CA>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #31 received at 1298 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Dan Nicolaescu <dann <at> ics.uci.edu>
Cc: 1298 <at> debbugs.gnu.org
Subject: Re: bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
Date: Tue, 18 Nov 2008 16:34:38 -0500
>> >> It would be nice if some equivalent of: 
>> >> 'emacsclient -a "emacs --daemon && emacsclient -c"
>> >> would work.
>> >> That would allow one to ALWAYS use emacsclient. 
>> 
>> > Here's a quick hack that allows:
>> > emacsclient -a "emacs --daemon && emacsclient -c" FILENAME
>> > to work.  It is not complete yet, FILENAME does not get passed to the
>> > "&& emacsclient"
>> 
>> Here's an alternative:
>> 
>> [ "$(emacsclient -e "'up" 2>/dev/null)" = "up" ] || emacs --daemon
>> emacsclient -c FILENAME

> I've been using something similar for a long time (even before
> --daemon), but it seems that it's more elegant to use a single command
> that shell hackery...

I think both are hacks, where my hack has the advantage of requiring no
changes to the code.  If you want to change the code, than I'd rather we
do it Right.


        Stefan




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1298; Package emacs. Full text and rfc822 format available.

Message #34 received at 1298 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Dan Nicolaescu <dann <at> ics.uci.edu>
To: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Cc: 1298 <at> debbugs.gnu.org
Subject: Re: bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
Date: Tue, 18 Nov 2008 14:19:57 -0800 (PST)
Stefan Monnier <monnier <at> IRO.UMontreal.CA> writes:

  > >> >> It would be nice if some equivalent of: 
  > >> >> 'emacsclient -a "emacs --daemon && emacsclient -c"
  > >> >> would work.
  > >> >> That would allow one to ALWAYS use emacsclient. 
  > >> 
  > >> > Here's a quick hack that allows:
  > >> > emacsclient -a "emacs --daemon && emacsclient -c" FILENAME
  > >> > to work.  It is not complete yet, FILENAME does not get passed to the
  > >> > "&& emacsclient"
  > >> 
  > >> Here's an alternative:
  > >> 
  > >> [ "$(emacsclient -e "'up" 2>/dev/null)" = "up" ] || emacs --daemon
  > >> emacsclient -c FILENAME
  > 
  > > I've been using something similar for a long time (even before
  > > --daemon), but it seems that it's more elegant to use a single command
  > > that shell hackery...
  > 
  > I think both are hacks, where my hack has the advantage of requiring no
  > changes to the code.  If you want to change the code, than I'd rather we
  > do it Right.

Well, now please don't tease, say what you mean by "do it Right"... 




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1298; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Andreas Schwab <schwab <at> suse.de>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #39 received at 1298 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Andreas Schwab <schwab <at> suse.de>
To: Dan Nicolaescu <dann <at> ics.uci.edu>
Cc: 1298 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Subject: Re: bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
Date: Wed, 19 Nov 2008 00:01:53 +0100
Dan Nicolaescu <dann <at> ics.uci.edu> writes:

> Well, now please don't tease, say what you mean by "do it Right"... 

Use a shell script.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab <at> suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1298; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Stefan Monnier <monnier <at> IRO.UMontreal.CA>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #44 received at 1298 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Dan Nicolaescu <dann <at> ics.uci.edu>
Cc: 1298 <at> debbugs.gnu.org
Subject: Re: bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
Date: Tue, 18 Nov 2008 18:01:32 -0500
>> I think both are hacks, where my hack has the advantage of requiring no
>> changes to the code.  If you want to change the code, than I'd rather we
>> do it Right.

> Well, now please don't tease, say what you mean by "do it Right"... 

I guess something that doesn't involve a shell would be a good start.


        Stefan




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1298; Package emacs. Full text and rfc822 format available.

Message #47 received at 1298 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Dan Nicolaescu <dann <at> ics.uci.edu>
To: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Cc: 1298 <at> debbugs.gnu.org
Subject: Re: bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
Date: Tue, 18 Nov 2008 15:27:04 -0800 (PST)
Stefan Monnier <monnier <at> IRO.UMontreal.CA> writes:

  > >> I think both are hacks, where my hack has the advantage of requiring no
  > >> changes to the code.  If you want to change the code, than I'd rather we
  > >> do it Right.
  > 
  > > Well, now please don't tease, say what you mean by "do it Right"... 
  > 
  > I guess something that doesn't involve a shell would be a good start.

The the was only used because of using && in the initial example.  Any
suggestions to get around that?

How about something like:

emacsclient --start-daemon 



PS: I was thinking "do it Right" would mean: get rid of emacsclient and
do everything in emacs... 




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1298; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #52 received at 1298 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Dan Nicolaescu <dann <at> ics.uci.edu>
Cc: 1298 <at> debbugs.gnu.org
Subject: Re: bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
Date: Tue, 18 Nov 2008 21:21:29 -0500
> How about something like:
> emacsclient --start-daemon 

You mean "emacsclient --start-daemon-if-needed FILENAME" ?
Yes, probably something like that.  It could potentially be folded into
the alternate-editor (e.g. if alternate-editor has some special value
such as the empty string).

> PS: I was thinking "do it Right" would mean: get rid of emacsclient and
> do everything in emacs... 

;-)


        Stefan




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1298; Package emacs. Full text and rfc822 format available.

Message #55 received at 1298 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Dan Nicolaescu <dann <at> ics.uci.edu>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 1298 <at> debbugs.gnu.org
Subject: Re: bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
Date: Sun, 7 Dec 2008 23:54:33 -0800 (PST)
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

  > > How about something like:
  > > emacsclient --start-daemon 
  > 
  > You mean "emacsclient --start-daemon-if-needed FILENAME" ?
  > Yes, probably something like that.  It could potentially be folded into
  > the alternate-editor (e.g. if alternate-editor has some special value
  > such as the empty string).

How does the patch below look like?
There's one refinement possible: make --start-daemon-if-needed take an
argument --start-daemon-if-needed=ARG and use it like this: emacs --daemon=ARG

Index: emacsclient.c
===================================================================
RCS file: /cvsroot/emacs/emacs/lib-src/emacsclient.c,v
retrieving revision 1.142
diff -u -3 -p -c -r1.142 emacsclient.c
cvs diff: conflicting specifications of output style
--- emacsclient.c	3 Dec 2008 04:33:44 -0000	1.142
+++ emacsclient.c	8 Dec 2008 07:52:45 -0000
@@ -150,6 +150,10 @@
 /* PID of the Emacs server process.  */
 int emacs_pid = 0;
 
+/* In case connecting to the server fails, try connecting again after
+   starting the emacs daemon.  */
+int start_daemon_if_needed = 0;
+
 void print_help_and_exit () NO_RETURN;
 
 struct option longopts[] =
@@ -162,6 +166,7 @@
   { "nw",	no_argument,       NULL, 't' },
   { "create-frame", no_argument,   NULL, 'c' },
   { "alternate-editor", required_argument, NULL, 'a' },
+  { "start-daemon-if-needed", no_argument, NULL, 'D' },
 #ifndef NO_SOCKETS_IN_FILE_SYSTEM
   { "socket-name",	required_argument, NULL, 's' },
 #endif
@@ -492,7 +497,7 @@
     {
       int opt = getopt_long_only (argc, argv,
 #ifndef NO_SOCKETS_IN_FILE_SYSTEM
-			     "VHnea:s:f:d:tc",
+			     "VHneDa:s:f:d:tc",
 #else
 			     "VHnea:f:d:tc",
 #endif
@@ -552,6 +557,10 @@
           current_frame = 0;
           break;
 
+        case 'D':
+          start_daemon_if_needed = 1;
+          break;
+
 	case 'H':
 	  print_help_and_exit ();
 	  break;
@@ -563,6 +572,12 @@
 	}
     }
 
+  if (start_daemon_if_needed && alternate_editor != NULL)
+    {
+      message (TRUE, "--alternate-editor cannot be used when using --start_daemon_if_needed\n");
+      exit (EXIT_FAILURE);
+    }
+
   /* If the -c option is used (without -t) and no --display argument
      is provided, try $DISPLAY.
      Without the -c option, we used to set `display' to $DISPLAY by
@@ -1294,7 +1309,7 @@
 #endif /* ! NO_SOCKETS_IN_FILE_SYSTEM */
 
 HSOCKET
-set_socket ()
+set_socket (int no_exit_if_error)
 {
   HSOCKET s;
 
@@ -1305,7 +1320,7 @@
   if (socket_name)
     {
       s = set_local_socket ();
-      if ((s != INVALID_SOCKET) || alternate_editor)
+      if ((s != INVALID_SOCKET) || no_exit_if_error)
 	return s;
       message (TRUE, "%s: error accessing socket \"%s\"\n",
 	       progname, socket_name);
@@ -1320,7 +1335,7 @@
   if (server_file)
     {
       s = set_tcp_socket ();
-      if ((s != INVALID_SOCKET) || alternate_editor)
+      if ((s != INVALID_SOCKET) || no_exit_if_error)
 	return s;
 
       message (TRUE, "%s: error accessing server file \"%s\"\n",
@@ -1338,7 +1353,7 @@
   /* Implicit server file.  */
   server_file = "server";
   s = set_tcp_socket ();
-  if ((s != INVALID_SOCKET) || alternate_editor)
+  if ((s != INVALID_SOCKET) || no_exit_if_error)
     return s;
 
   /* No implicit or explicit socket, and no alternate editor.  */
@@ -1353,7 +1368,7 @@
 }
 
 #ifdef WINDOWSNT
-FARPROC set_fg;  /* Pointer to AllowSetForegroundWindow.  */
+FARPROC se t_fg;  /* Pointer to AllowSetForegroundWindow.  */
 FARPROC get_wc;  /* Pointer to RealGetWindowClassA.  */
 
 BOOL CALLBACK
@@ -1416,6 +1431,8 @@
   int i, rl, needlf = 0;
   char *cwd, *str;
   char string[BUFSIZ+1];
+  int null_socket_name;
+  int null_server_file;
 
   main_argv = argv;
   progname = argv[0];
@@ -1431,9 +1448,57 @@
       exit (EXIT_FAILURE);
     }
 
-  if ((emacs_socket = set_socket ()) == INVALID_SOCKET)
-    fail ();
+  if (start_daemon_if_needed)
+    {
+      /* set_socket changes the values for socket_name and
+	 server_file, we need to reset them, if they were NULL before
+	 for the second call to set_socket.  */
+      null_socket_name = (socket_name == NULL);
+      null_server_file = (server_file == NULL);
+    }
+
+  if ((emacs_socket = set_socket (alternate_editor || start_daemon_if_needed)) == INVALID_SOCKET)
+    if (start_daemon_if_needed)
+      {
+	pid_t dpid;
+	int status;
+	pid_t p;
+
+	dpid = fork ();
 
+	if (dpid > 0)
+	  {
+	    p = waitpid (dpid, &status, WUNTRACED | WCONTINUED);
+
+	    /* Reset socket_name and server_file if they were NULL
+	       before the set_socket call.  */
+	    if (null_socket_name)
+	      socket_name = NULL;
+	    if (null_server_file)
+	      server_file = NULL;
+
+	    /* Try connecting again, the daemon should have started by
+	       now.  */
+	    message (TRUE, "daemon should have started, trying to connect again\n", dpid);
+	    if ((emacs_socket = set_socket (1)) == INVALID_SOCKET)
+	      message (TRUE, "Cannot connect even after starting the daemon\n");
+	  }
+	else if (dpid < 0)
+	  {
+	    fprintf (stderr, "Cannot fork!\n");
+	    exit (1);
+	  }
+	else
+	  {
+	    char *const d_argv[] = {"emacs", "--daemon", 0 };
+
+	    /* Start the daemon. */
+	    execvp ("emacs", d_argv);
+	    message (TRUE, "%s: error starting emacs daemon\n", progname);
+	  }
+      }
+    else
+      fail ();
 
   cwd = get_current_dir_name ();
   if (cwd == 0)




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1298; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #60 received at 1298 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Dan Nicolaescu <dann <at> ics.uci.edu>
Cc: 1298 <at> debbugs.gnu.org
Subject: Re: bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
Date: Mon, 08 Dec 2008 11:44:55 -0500
>> > How about something like:
>> > emacsclient --start-daemon
>> You mean "emacsclient --start-daemon-if-needed FILENAME" ?
>> Yes, probably something like that.  It could potentially be folded into
>> the alternate-editor (e.g. if alternate-editor has some special value
>> such as the empty string).
> How does the patch below look like?

I'd prefer to combine it with --alternate-editor since the two args are
mutually exclusive.  Have you tried it and it caused problems?

> There's one refinement possible: make --start-daemon-if-needed take an
> argument --start-daemon-if-needed=ARG and use it like this:
> emacs --daemon=ARG

I think this ARG should automatically be taken from the
usual --socket-name argument.


        Stefan




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1298; Package emacs. Full text and rfc822 format available.

Message #63 received at 1298 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Dan Nicolaescu <dann <at> ics.uci.edu>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 1298 <at> debbugs.gnu.org
Subject: Re: bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
Date: Mon, 8 Dec 2008 09:09:29 -0800 (PST)
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

  > >> > How about something like:
  > >> > emacsclient --start-daemon
  > >> You mean "emacsclient --start-daemon-if-needed FILENAME" ?
  > >> Yes, probably something like that.  It could potentially be folded into
  > >> the alternate-editor (e.g. if alternate-editor has some special value
  > >> such as the empty string).
  > > How does the patch below look like?
  > 
  > I'd prefer to combine it with --alternate-editor since the two args are
  > mutually exclusive.  Have you tried it and it caused problems?

I didn't quite get what you said... It should probably work, modulo ... 

  > > There's one refinement possible: make --start-daemon-if-needed take an
  > > argument --start-daemon-if-needed=ARG and use it like this:
  > > emacs --daemon=ARG
  > 
  > I think this ARG should automatically be taken from the
  > usual --socket-name argument.

... this: That won't work in the future when we extend --daemon to be able to
specify a TCP port for example: --daemon=FILENAME:TCP_PORT




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1298; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #68 received at 1298 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Dan Nicolaescu <dann <at> ics.uci.edu>
Cc: 1298 <at> debbugs.gnu.org
Subject: Re: bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
Date: Mon, 08 Dec 2008 15:07:16 -0500
>> >> > How about something like:
>> >> > emacsclient --start-daemon
>> >> You mean "emacsclient --start-daemon-if-needed FILENAME" ?
>> >> Yes, probably something like that.  It could potentially be folded into
>> >> the alternate-editor (e.g. if alternate-editor has some special value
>> >> such as the empty string).
>> > How does the patch below look like?
>> 
>> I'd prefer to combine it with --alternate-editor since the two args are
>> mutually exclusive.  Have you tried it and it caused problems?

> I didn't quite get what you said... It should probably work, modulo ... 

>> > There's one refinement possible: make --start-daemon-if-needed take an
>> > argument --start-daemon-if-needed=ARG and use it like this:
>> > emacs --daemon=ARG
>> 
>> I think this ARG should automatically be taken from the
>> usual --socket-name argument.

> ... this: That won't work in the future when we extend --daemon to be able to
> specify a TCP port for example: --daemon=FILENAME:TCP_PORT

No need to worry about that: I've already explicitly rejected a tcp-port
option for server.el in the past, so I'll be happy to give other such
rejections in the future.


        Stefan


PS: The magical value for --alternate-editory should hopefully also work
in $ALTERNATE_EDITOR.




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1298; Package emacs. Full text and rfc822 format available.

Message #71 received at 1298 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Dan Nicolaescu <dann <at> ics.uci.edu>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 1298 <at> debbugs.gnu.org
Subject: Re: bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
Date: Mon, 8 Dec 2008 12:20:49 -0800 (PST)
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

  > >> >> > How about something like:
  > >> >> > emacsclient --start-daemon
  > >> >> You mean "emacsclient --start-daemon-if-needed FILENAME" ?
  > >> >> Yes, probably something like that.  It could potentially be folded into
  > >> >> the alternate-editor (e.g. if alternate-editor has some special value
  > >> >> such as the empty string).
  > >> > How does the patch below look like?
  > >> 
  > >> I'd prefer to combine it with --alternate-editor since the two args are
  > >> mutually exclusive.  Have you tried it and it caused problems?
  > 
  > > I didn't quite get what you said... It should probably work, modulo ... 
  > 
  > >> > There's one refinement possible: make --start-daemon-if-needed take an
  > >> > argument --start-daemon-if-needed=ARG and use it like this:
  > >> > emacs --daemon=ARG
  > >> 
  > >> I think this ARG should automatically be taken from the
  > >> usual --socket-name argument.
  > 
  > > ... this: That won't work in the future when we extend --daemon to be able to
  > > specify a TCP port for example: --daemon=FILENAME:TCP_PORT
  > 
  > No need to worry about that: I've already explicitly rejected a tcp-port
  > option for server.el in the past, so I'll be happy to give other such
  > rejections in the future.

Hmm, you said the reverse here: http://article.gmane.org/gmane.emacs.devel/103350





Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1298; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Stefan Monnier <monnier <at> IRO.UMontreal.CA>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #76 received at 1298 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Dan Nicolaescu <dann <at> ics.uci.edu>
Cc: 1298 <at> debbugs.gnu.org
Subject: Re: bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
Date: Mon, 08 Dec 2008 16:48:25 -0500
>> No need to worry about that: I've already explicitly rejected a tcp-port
>> option for server.el in the past, so I'll be happy to give other such
>> rejections in the future.

> Hmm, you said the reverse here:
> http://article.gmane.org/gmane.emacs.devel/103350

Indeed.  Consistency is the hgolm, isn't it?
In any case, I think it's more important to handle the alternate-editor
issue than the tcp port issue.


        Stefan




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1298; Package emacs. Full text and rfc822 format available.

Message #79 received at 1298 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Dan Nicolaescu <dann <at> ics.uci.edu>
To: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Cc: 1298 <at> debbugs.gnu.org
Subject: Re: bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
Date: Tue, 9 Dec 2008 10:58:32 -0800 (PST)
Stefan Monnier <monnier <at> IRO.UMontreal.CA> writes:

  > >> No need to worry about that: I've already explicitly rejected a tcp-port
  > >> option for server.el in the past, so I'll be happy to give other such
  > >> rejections in the future.
  > 
  > > Hmm, you said the reverse here:
  > > http://article.gmane.org/gmane.emacs.devel/103350
  > 
  > Indeed.  Consistency is the hgolm, isn't it?

hgolm?

Updated patch that uses -a ""  or --alternate-editor= or
ALTERNATE_EDITOR="":

Index: emacsclient.c
===================================================================
RCS file: /cvsroot/emacs/emacs/lib-src/emacsclient.c,v
retrieving revision 1.142
diff -u -3 -p -u -p -r1.142 emacsclient.c
--- emacsclient.c	3 Dec 2008 04:33:44 -0000	1.142
+++ emacsclient.c	9 Dec 2008 18:53:51 -0000
@@ -1294,7 +1294,7 @@ To start the server in Emacs, type \"M-x
 #endif /* ! NO_SOCKETS_IN_FILE_SYSTEM */
 
 HSOCKET
-set_socket ()
+set_socket (int no_exit_if_error)
 {
   HSOCKET s;
 
@@ -1305,7 +1305,7 @@ set_socket ()
   if (socket_name)
     {
       s = set_local_socket ();
-      if ((s != INVALID_SOCKET) || alternate_editor)
+      if ((s != INVALID_SOCKET) || no_exit_if_error)
 	return s;
       message (TRUE, "%s: error accessing socket \"%s\"\n",
 	       progname, socket_name);
@@ -1320,7 +1320,7 @@ set_socket ()
   if (server_file)
     {
       s = set_tcp_socket ();
-      if ((s != INVALID_SOCKET) || alternate_editor)
+      if ((s != INVALID_SOCKET) || no_exit_if_error)
 	return s;
 
       message (TRUE, "%s: error accessing server file \"%s\"\n",
@@ -1338,7 +1338,7 @@ set_socket ()
   /* Implicit server file.  */
   server_file = "server";
   s = set_tcp_socket ();
-  if ((s != INVALID_SOCKET) || alternate_editor)
+  if ((s != INVALID_SOCKET) || no_exit_if_error)
     return s;
 
   /* No implicit or explicit socket, and no alternate editor.  */
@@ -1416,6 +1416,7 @@ main (argc, argv)
   int i, rl, needlf = 0;
   char *cwd, *str;
   char string[BUFSIZ+1];
+  int null_socket_name, null_server_file, start_daemon_if_needed;
 
   main_argv = argv;
   progname = argv[0];
@@ -1431,9 +1432,68 @@ main (argc, argv)
       exit (EXIT_FAILURE);
     }
 
-  if ((emacs_socket = set_socket ()) == INVALID_SOCKET)
-    fail ();
-
+  start_daemon_if_needed = (alternate_editor
+			    && (alternate_editor[0] == '\0'));
+  if (start_daemon_if_needed)
+    {
+      /* set_socket changes the values for socket_name and
+	 server_file, we need to reset them, if they were NULL before
+	 for the second call to set_socket.  */
+      null_socket_name = (socket_name == NULL);
+      null_server_file = (server_file == NULL);
+    }
+
+  if ((emacs_socket = set_socket (alternate_editor
+				  || start_daemon_if_needed)) == INVALID_SOCKET)
+    if (start_daemon_if_needed)
+      {
+	pid_t dpid;
+	int status;
+	pid_t p;
+
+	/* Reset socket_name and server_file if they were NULL
+	   before the set_socket call.  */
+	if (null_socket_name)
+	  socket_name = NULL;
+	if (null_server_file)
+	  server_file = NULL;
+
+	dpid = fork ();
+
+	if (dpid > 0)
+	  {
+	    p = waitpid (dpid, &status, WUNTRACED | WCONTINUED);
+
+	    /* Try connecting again, the daemon should have started by
+	       now.  */
+	    message (TRUE, "daemon should have started, trying to connect again\n", dpid);
+	    if ((emacs_socket = set_socket (1)) == INVALID_SOCKET)
+	      message (TRUE, "Cannot connect even after starting the daemon\n");
+	  }
+	else if (dpid < 0)
+	  {
+	    fprintf (stderr, "Cannot fork!\n");
+	    exit (1);
+	  }
+	else
+	  {
+	    char *d_argv[] = {"emacs", "--daemon", 0 };
+	    if (!null_socket_name)
+	      {
+		/* Pass  --daemon=socket_name as argument.  */
+		char *deq = "--daemon=";
+		char *daemon_arg = alloca (strlen (deq)
+					   + strlen (socket_name) + 1);
+		strcpy (daemon_arg, deq);
+		strcat (daemon_arg, socket_name);
+		d_argv[1] = daemon_arg;
+	      }
+	    execvp ("emacs", d_argv);
+	    message (TRUE, "%s: error starting emacs daemon\n", progname);
+	  }
+      }
+    else
+      fail ();
 
   cwd = get_current_dir_name ();
   if (cwd == 0)




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1298; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to "Juanma Barranquero" <lekktu <at> gmail.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #84 received at 1298 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: "Juanma Barranquero" <lekktu <at> gmail.com>
To: "Dan Nicolaescu" <dann <at> ics.uci.edu>, 1298 <at> debbugs.gnu.org
Cc: "Stefan Monnier" <monnier <at> iro.umontreal.ca>
Subject: Re: bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
Date: Tue, 9 Dec 2008 20:30:49 +0100
On Tue, Dec 9, 2008 at 19:58, Dan Nicolaescu <dann <at> ics.uci.edu> wrote:

>  > Indeed.  Consistency is the hgolm, isn't it?
>
> hgolm?

http://www.bartleby.com/59/3/foolishconsi.html

    Juanma




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1298; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Stefan Monnier <monnier <at> IRO.UMontreal.CA>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #89 received at 1298 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Dan Nicolaescu <dann <at> ics.uci.edu>
Cc: 1298 <at> debbugs.gnu.org
Subject: Re: bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
Date: Tue, 09 Dec 2008 15:07:35 -0500
>> >> No need to worry about that: I've already explicitly rejected a tcp-port
>> >> option for server.el in the past, so I'll be happy to give other such
>> >> rejections in the future.
>> > Hmm, you said the reverse here:
>> > http://article.gmane.org/gmane.emacs.devel/103350
>> Indeed.  Consistency is the hgolm, isn't it?
> hgolm?

http://www.bartleby.com/59/3/foolishconsi.html

> Updated patch that uses -a ""  or --alternate-editor= or
> ALTERNATE_EDITOR="":

Looks OK, except that the whole body of the if, where you do the fork
etc.. deserves its own function.


        Stefan




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1298; Package emacs. Full text and rfc822 format available.

Message #92 received at 1298 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Dan Nicolaescu <dann <at> ics.uci.edu>
To: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Cc: 1298 <at> debbugs.gnu.org
Subject: Re: bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
Date: Tue, 9 Dec 2008 23:58:47 -0800 (PST)
Stefan Monnier <monnier <at> IRO.UMontreal.CA> writes:

  > >> >> No need to worry about that: I've already explicitly rejected a tcp-port
  > >> >> option for server.el in the past, so I'll be happy to give other such
  > >> >> rejections in the future.
  > >> > Hmm, you said the reverse here:
  > >> > http://article.gmane.org/gmane.emacs.devel/103350
  > >> Indeed.  Consistency is the hgolm, isn't it?
  > > hgolm?
  > 
  > http://www.bartleby.com/59/3/foolishconsi.html
  > 
  > > Updated patch that uses -a ""  or --alternate-editor= or
  > > ALTERNATE_EDITOR="":
  > 
  > Looks OK, except that the whole body of the if, where you do the fork
  > etc.. deserves its own function.

Thanks. Checked in with that change.




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1298; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to "Juanma Barranquero" <lekktu <at> gmail.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #97 received at 1298 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: "Juanma Barranquero" <lekktu <at> gmail.com>
To: "Dan Nicolaescu" <dann <at> ics.uci.edu>, 1298 <at> debbugs.gnu.org
Cc: "Stefan Monnier" <monnier <at> iro.umontreal.ca>
Subject: Re: bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
Date: Wed, 10 Dec 2008 10:49:15 +0100
On Wed, Dec 10, 2008 at 08:58, Dan Nicolaescu <dann <at> ics.uci.edu> wrote:

> Thanks. Checked in with that change.

I've checked in the minimal change that allows emacsclient to build on
Windows again.

Feel free to adapt to your tastes, but please, don't delete the
EMACS_DAEMON define.

  Juanma




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1298; Package emacs. Full text and rfc822 format available.

Message #100 received at 1298 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Dan Nicolaescu <dann <at> ics.uci.edu>
To: Juanma Barranquero <lekktu <at> gmail.com>
Cc: 1298 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Subject: Re: bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
Date: Wed, 10 Dec 2008 07:03:39 -0800 (PST)
"Juanma Barranquero" <lekktu <at> gmail.com> writes:

  > On Wed, Dec 10, 2008 at 08:58, Dan Nicolaescu <dann <at> ics.uci.edu> wrote:
  > 
  > > Thanks. Checked in with that change.
  > 
  > I've checked in the minimal change that allows emacsclient to build on
  > Windows again.
  > 
  > Feel free to adapt to your tastes, but please, don't delete the
  > EMACS_DAEMON define.

As you well know my taste is exactly not to add such #defines.  There's
not such #define in the daemon implementation in src, the new macro in
undocumented, and your move was just designed as a provocation.




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1298; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to "Juanma Barranquero" <lekktu <at> gmail.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #105 received at 1298 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: "Juanma Barranquero" <lekktu <at> gmail.com>
To: "Dan Nicolaescu" <dann <at> ics.uci.edu>
Cc: 1298 <at> debbugs.gnu.org,
        "Stefan Monnier" <monnier <at> iro.umontreal.ca>
Subject: Re: bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
Date: Wed, 10 Dec 2008 16:10:34 +0100
On Wed, Dec 10, 2008 at 16:03, Dan Nicolaescu <dann <at> ics.uci.edu> wrote:

> As you well know my taste is exactly not to add such #defines.

As you well know, some of us prefer such defines, when needed.

> There's
> not such #define in the daemon implementation in src,

But it is neeeded. What you just committed does *not* work on Windows.

> the new macro in
> undocumented,

That can easily be fixed by documenting.

> and your move was just designed as a provocation.

No, it was not; it's just that I like my emacsclient working. But
curiously I've got the same feeling from your action: that is was just
a provocation. What do you want for us to do, to engage in a pointless
commit war (because, IIRC, emacsclient.c is not yours only to decide).

Do not remove Windows changes unless you're providing an equivalent,
or better, fix. So please, revert your change or fix it so I *don't*
need to use an alternate server.

  C:\emacs> emacsclient --alternate-editor=c:\emacs\bin\emacs.exe my-file.txt
  emacsclient: connect: No se ha podido establecer conexi¾n ya que el
equipo de destino ha
  denegado activamente dicha conexi¾n

The message says: "could not establish a connection because the
destination computer actively rejected the connection", more or less.

    Juanma

Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1298; Package emacs. Full text and rfc822 format available.

Message #108 received at 1298 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Dan Nicolaescu <dann <at> ics.uci.edu>
To: "Juanma Barranquero" <lekktu <at> gmail.com>
Cc: 1298 <at> debbugs.gnu.org,
        "Stefan Monnier" <monnier <at> iro.umontreal.ca>
Subject: Re: bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
Date: Wed, 10 Dec 2008 07:29:42 -0800 (PST)
"Juanma Barranquero" <lekktu <at> gmail.com> writes:

  > On Wed, Dec 10, 2008 at 16:03, Dan Nicolaescu <dann <at> ics.uci.edu> wrote:
  > 
  > 
  > > There's
  > > not such #define in the daemon implementation in src,
  > 
  > But it is neeeded. 

That's a separate discussion that I am not interested in.  When such a
macro is added, this can be revisited and be made consistent.

  > What you just committed does *not* work on Windows.

There was a bug that I fixed, not related to any new macro.





Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1298; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to "Juanma Barranquero" <lekktu <at> gmail.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #113 received at 1298 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: "Juanma Barranquero" <lekktu <at> gmail.com>
To: "Dan Nicolaescu" <dann <at> ics.uci.edu>
Cc: 1298 <at> debbugs.gnu.org,
        "Stefan Monnier" <monnier <at> iro.umontreal.ca>
Subject: Re: bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
Date: Wed, 10 Dec 2008 16:32:17 +0100
On Wed, Dec 10, 2008 at 16:29, Dan Nicolaescu <dann <at> ics.uci.edu> wrote:

> That's a separate discussion that I am not interested in.

There's quite a difference between "I'm not interested in discussing
this" and "I'm going to revert your changes because I don't like what
you did, even if I know that you do".

> When such a
> macro is added, this can be revisited and be made consistent.

Perhaps you've forgotten that the macro was added. And deleted. By you.

    Juanma




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1298; Package emacs. Full text and rfc822 format available.

Message #116 received at 1298 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Dan Nicolaescu <dann <at> ics.uci.edu>
To: "Juanma Barranquero" <lekktu <at> gmail.com>
Cc: 1298 <at> debbugs.gnu.org,
        "Stefan Monnier" <monnier <at> iro.umontreal.ca>
Subject: Re: bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
Date: Wed, 10 Dec 2008 07:43:25 -0800 (PST)
"Juanma Barranquero" <lekktu <at> gmail.com> writes:

  > On Wed, Dec 10, 2008 at 16:29, Dan Nicolaescu <dann <at> ics.uci.edu> wrote:
  > 
  > > That's a separate discussion that I am not interested in.
  > 
  > There's quite a difference between "I'm not interested in discussing
  > this" and "I'm going to revert your changes because I don't like what
  > you did, even if I know that you do".

Omitting quotes to modify the meaning is not very productive:

The sequence is:
1.
Dan> There's
Dan> not such #define in the daemon implementation in src,

2.
Juanma> But it is neeeded. What you just committed does *not* work on Windows.

3.
Dan> That's a separate discussion that I am not interested in.
Dan> When such a
Dan> macro is added, this can be revisited and be made consistent.

Can you please STOP this?




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1298; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to "Juanma Barranquero" <lekktu <at> gmail.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #121 received at 1298 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: "Juanma Barranquero" <lekktu <at> gmail.com>
To: "Dan Nicolaescu" <dann <at> ics.uci.edu>
Cc: 1298 <at> debbugs.gnu.org,
        "Stefan Monnier" <monnier <at> iro.umontreal.ca>
Subject: Re: bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
Date: Wed, 10 Dec 2008 16:55:24 +0100
On Wed, Dec 10, 2008 at 16:43, Dan Nicolaescu <dann <at> ics.uci.edu> wrote:

> Omitting quotes to modify the meaning is not very productive:

Then don't do it.

    Juanma




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1298; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #126 received at 1298 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Dan Nicolaescu <dann <at> ics.uci.edu>
Cc: Juanma Barranquero <lekktu <at> gmail.com>, 1298 <at> debbugs.gnu.org
Subject: Re: bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
Date: Thu, 11 Dec 2008 11:37:13 -0500
> As you well know my taste is exactly not to add such #defines.  There's
> not such #define in the daemon implementation in src, the new macro in
> undocumented, and your move was just designed as a provocation.

Please, let's calm down.

I generally agree that it's better to use "#ifdef <FEATURE>" than
"#ifdef <PLATFORM>" (tho it always depends on the specifics), so to
a large extent I prefer Juanma's code in this case.  But in any case,
when it's a question of taste, the one who wrote the code (Juanma in
this case, even if it touched the code you wrote) gets to choose.
Only ever change someone else's code when it's uncontroversial, or only
after a discussion here concluded it's better to change it.  In this
case, it's clearly controversial.


        Stefan




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1298; Package emacs. Full text and rfc822 format available.

Message #129 received at 1298 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Dan Nicolaescu <dann <at> ics.uci.edu>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Juanma Barranquero <lekktu <at> gmail.com>, 1298 <at> debbugs.gnu.org
Subject: Re: bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
Date: Thu, 11 Dec 2008 09:08:54 -0800 (PST)
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

  > > As you well know my taste is exactly not to add such #defines.  There's
  > > not such #define in the daemon implementation in src, the new macro in
  > > undocumented, and your move was just designed as a provocation.
  > 
  > Please, let's calm down.
  > 
  > I generally agree that it's better to use "#ifdef <FEATURE>" than
  > "#ifdef <PLATFORM>" (tho it always depends on the specifics), so to
  > a large extent I prefer Juanma's code in this case.  But in any case,
  > when it's a question of taste, the one who wrote the code (Juanma in
  > this case, even if it touched the code you wrote) gets to choose.
  > Only ever change someone else's code when it's uncontroversial, or only
  > after a discussion here concluded it's better to change it.  In this
  > case, it's clearly controversial.

I think you got it wrong here.  I wrote the code, Juanma just sprinkled
a few #ifdefs to simply disable it on windows, nothing else.  He knew
clearly well what my taste is.  Given that I get to fix bugs in the
code, I prefer for it to be done in the way I think it's right.




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1298; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to "Juanma Barranquero" <lekktu <at> gmail.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #134 received at 1298 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: "Juanma Barranquero" <lekktu <at> gmail.com>
To: "Dan Nicolaescu" <dann <at> ics.uci.edu>
Cc: "Stefan Monnier" <monnier <at> iro.umontreal.ca>,
        1298 <at> debbugs.gnu.org
Subject: Re: bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
Date: Thu, 11 Dec 2008 20:05:09 +0100
On Thu, Dec 11, 2008 at 18:08, Dan Nicolaescu <dann <at> ics.uci.edu> wrote:

> I think you got it wrong here.  I wrote the code

Really? All of emacsclient.c, or it's only the parts you touch that turn yours?

> Juanma just sprinkled
> a few #ifdefs to simply disable it on windows, nothing else.

Your revisionism won't change the fact that I didn't "disable things
on Windows", I made it work *twice* where you carelessly broke it (on
Windows and, apparently, also on GNU/Linux).

> Given that I get to fix bugs in the
> code, I prefer for it to be done in the way I think it's right.

That's the very reason why I did it my way: because I was fixing bugs.
The ones you introduced.

    Juanma




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1298; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #139 received at 1298 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Dan Nicolaescu <dann <at> ics.uci.edu>
Cc: Juanma Barranquero <lekktu <at> gmail.com>, 1298 <at> debbugs.gnu.org
Subject: Re: bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
Date: Thu, 11 Dec 2008 14:06:20 -0500
> I think you got it wrong here.  I wrote the code, Juanma just sprinkled
> a few #ifdefs to simply disable it on windows, nothing else.  He knew
> clearly well what my taste is.  Given that I get to fix bugs in the
> code, I prefer for it to be done in the way I think it's right.

I know you disagree, but he wrote the ifdefs, so the ifdefs are
his code.


        Stefan




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1298; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to "Juanma Barranquero" <lekktu <at> gmail.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #144 received at 1298 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: "Juanma Barranquero" <lekktu <at> gmail.com>
To: "Stefan Monnier" <monnier <at> iro.umontreal.ca>
Cc: "Dan Nicolaescu" <dann <at> ics.uci.edu>, 1298 <at> debbugs.gnu.org
Subject: Re: bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
Date: Thu, 11 Dec 2008 20:08:53 +0100
On Thu, Dec 11, 2008 at 20:06, Stefan Monnier <monnier <at> iro.umontreal.ca> wrote:

> I know you disagree, but he wrote the ifdefs, so the ifdefs are
> his code.

OTOH, we could apply his reasoning to the TCP code in emacsclient.c (I
wrote most of it, after all), so I get rights to change everything Dan
makes in that code...

    Juanma




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1298; Package emacs. Full text and rfc822 format available.

Message #147 received at 1298 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Dan Nicolaescu <dann <at> ics.uci.edu>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Juanma Barranquero <lekktu <at> gmail.com>, 1298 <at> debbugs.gnu.org
Subject: Re: bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
Date: Thu, 11 Dec 2008 11:28:29 -0800 (PST)
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

  > > I think you got it wrong here.  I wrote the code, Juanma just sprinkled
  > > a few #ifdefs to simply disable it on windows, nothing else.  He knew
  > > clearly well what my taste is.  Given that I get to fix bugs in the
  > > code, I prefer for it to be done in the way I think it's right.
  > 
  > I know you disagree, but he wrote the ifdefs, so the ifdefs are
  > his code.

By that reasoning, should anyone feel free to change your code in a way
we know you dislike and that would be fine?  And you'd just let that
stand?  I don't think so.

I would have done the changes to disable the code on windows, but Juanma
was just quicker (so thanks, but no thanks) and intentionally chose to
be confrontational, as seen from all his extremely aggressive followup
emails and continuous misinterpretation and badgering.  I don't like to
tolerate bullies like that.




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1298; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to "Juanma Barranquero" <lekktu <at> gmail.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #152 received at 1298 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: "Juanma Barranquero" <lekktu <at> gmail.com>
To: "Dan Nicolaescu" <dann <at> ics.uci.edu>
Cc: "Stefan Monnier" <monnier <at> iro.umontreal.ca>,
        1298 <at> debbugs.gnu.org
Subject: Re: bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
Date: Thu, 11 Dec 2008 20:58:30 +0100
On Thu, Dec 11, 2008 at 20:28, Dan Nicolaescu <dann <at> ics.uci.edu> wrote:

> intentionally chose to
> be confrontational

Yes, of course. I usually say "please" when I try to be confrontational.

> as seen from all his extremely aggressive followup
> emails and continuous misinterpretation and badgering.  I don't like to
> tolerate bullies like that.

The pot, calling the kettle black..

    Juanma




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1298; Package emacs. Full text and rfc822 format available.

Message #155 received at 1298 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Dan Nicolaescu <dann <at> ics.uci.edu>
To: Juanma Barranquero <lekktu <at> gmail.com>
Cc: 1298 <at> debbugs.gnu.org
Subject: Re: bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
Date: Thu, 11 Dec 2008 12:39:45 -0800 (PST)
"Juanma Barranquero" <lekktu <at> gmail.com> writes:

  > On Thu, Dec 11, 2008 at 20:28, Dan Nicolaescu <dann <at> ics.uci.edu> wrote:
  > 
  > > intentionally chose to
  > > be confrontational
  > 
  > Yes, of course. I usually say "please" when I try to be confrontational.

Your actions speak by themselves: you had no contribution to that code,
no contribution to thinking about the problem, how to solve it,
discussing it, coding, getting it approved.
You also have no interest in improving the code, just getting it out of
the way.
You knew exactly what my opinion was on adding extra #defines, but
despite all the above, you chose ignore that opinion, not even ask, and
barrel through and do it that way you wanted.
That's confrontational, and you've been that way in ALL your followup
messages.




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1298; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to "Juanma Barranquero" <lekktu <at> gmail.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #160 received at 1298 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: "Juanma Barranquero" <lekktu <at> gmail.com>
To: "Dan Nicolaescu" <dann <at> ics.uci.edu>
Cc: 1298 <at> debbugs.gnu.org
Subject: Re: bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
Date: Thu, 11 Dec 2008 21:48:17 +0100
On Thu, Dec 11, 2008 at 21:39, Dan Nicolaescu <dann <at> ics.uci.edu> wrote:

> Your actions speak by themselves: you had no contribution to that code,
> no contribution to thinking about the problem, how to solve it,
> discussing it, coding, getting it approved.

Things that you're obviously doing a lot.

> You also have no interest in improving the code, just getting it out of
> the way.

I moved code out of the way. Your "fix" to my fix was, in both cases,
leaving the same code "out of the way". In one case you changed the
define, and in the other you removed the code I had #ifdef'd out. So I
was not that misguided, it seems.

> That's confrontational, and you've been that way in ALL your followup
> messages.

Kettle, pot, black again.

    Juanma




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1298; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #165 received at 1298 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Dan Nicolaescu <dann <at> ics.uci.edu>
Cc: Juanma Barranquero <lekktu <at> gmail.com>, 1298 <at> debbugs.gnu.org
Subject: Re: bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
Date: Thu, 11 Dec 2008 15:58:52 -0500
This discussion is pointless and hence over.


        Stefan


>>>>> "Dan" == Dan Nicolaescu <dann <at> ics.uci.edu> writes:

> Stefan Monnier <monnier <at> iro.umontreal.ca> writes:
>> > I think you got it wrong here.  I wrote the code, Juanma just sprinkled
>> > a few #ifdefs to simply disable it on windows, nothing else.  He knew
>> > clearly well what my taste is.  Given that I get to fix bugs in the
>> > code, I prefer for it to be done in the way I think it's right.
>> 
>> I know you disagree, but he wrote the ifdefs, so the ifdefs are
>> his code.

> By that reasoning, should anyone feel free to change your code in a way
> we know you dislike and that would be fine?  And you'd just let that
> stand?  I don't think so.

> I would have done the changes to disable the code on windows, but Juanma
> was just quicker (so thanks, but no thanks) and intentionally chose to
> be confrontational, as seen from all his extremely aggressive followup
> emails and continuous misinterpretation and badgering.  I don't like to
> tolerate bullies like that.




Reply sent to Dan Nicolaescu <dann <at> ics.uci.edu>:
You have taken responsibility. Full text and rfc822 format available.

Notification sent to Dan Nicolaescu <dann <at> ics.uci.edu>:
bug acknowledged by developer. Full text and rfc822 format available.

Message #170 received at 1298-done <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Dan Nicolaescu <dann <at> ics.uci.edu>
To: 1298-done <at> debbugs.gnu.org
Subject: Re: bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
Date: Thu, 11 Dec 2008 13:23:16 -0800 (PST)
Fixed.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> emacsbugs.donarmstrong.com. (Fri, 09 Jan 2009 15:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 16 years and 168 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.