unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
@ 2008-11-02 18:18 ` Dan Nicolaescu
  2008-11-18  8:22   ` Dan Nicolaescu
  2008-12-11 21:25   ` bug#1298: marked as done (allow 'emacsclient -a "emacs --daemon && emacsclient -c"') Emacs bug Tracking System
  0 siblings, 2 replies; 39+ messages in thread
From: Dan Nicolaescu @ 2008-11-02 18:18 UTC (permalink / raw)
  To: bug-gnu-emacs


It would be nice if some equivalent of: 

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

would work.

That would allow one to ALWAYS use emacsclient. 







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

* bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
  2008-11-02 18:18 ` bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"' Dan Nicolaescu
@ 2008-11-18  8:22   ` Dan Nicolaescu
  2008-11-18 16:36     ` Stefan Monnier
  2008-11-18 19:43     ` Eli Zaretskii
  2008-12-11 21:25   ` bug#1298: marked as done (allow 'emacsclient -a "emacs --daemon && emacsclient -c"') Emacs bug Tracking System
  1 sibling, 2 replies; 39+ messages in thread
From: Dan Nicolaescu @ 2008-11-18  8:22 UTC (permalink / raw)
  To: 1298

Dan Nicolaescu <dann@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?






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

* bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
  2008-11-18  8:22   ` Dan Nicolaescu
@ 2008-11-18 16:36     ` Stefan Monnier
  2008-11-18 18:17       ` Dan Nicolaescu
  2008-11-18 19:43     ` Eli Zaretskii
  1 sibling, 1 reply; 39+ messages in thread
From: Stefan Monnier @ 2008-11-18 16:36 UTC (permalink / raw)
  To: Dan Nicolaescu; +Cc: 1298

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






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

* bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
  2008-11-18 16:36     ` Stefan Monnier
@ 2008-11-18 18:17       ` Dan Nicolaescu
  2008-11-18 21:34         ` Stefan Monnier
  0 siblings, 1 reply; 39+ messages in thread
From: Dan Nicolaescu @ 2008-11-18 18:17 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 1298

Stefan Monnier <monnier@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...






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

* bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
  2008-11-18  8:22   ` Dan Nicolaescu
  2008-11-18 16:36     ` Stefan Monnier
@ 2008-11-18 19:43     ` Eli Zaretskii
  1 sibling, 0 replies; 39+ messages in thread
From: Eli Zaretskii @ 2008-11-18 19:43 UTC (permalink / raw)
  To: Dan Nicolaescu, 1298; +Cc: 1298, bug-gnu-emacs, bug-submit-list

> Date: Tue, 18 Nov 2008 00:22:33 -0800 (PST)
> From: Dan Nicolaescu <dann@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.







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

* bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
  2008-11-18 18:17       ` Dan Nicolaescu
@ 2008-11-18 21:34         ` Stefan Monnier
  2008-11-18 22:19           ` Dan Nicolaescu
  0 siblings, 1 reply; 39+ messages in thread
From: Stefan Monnier @ 2008-11-18 21:34 UTC (permalink / raw)
  To: Dan Nicolaescu; +Cc: 1298

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






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

* bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
  2008-11-18 21:34         ` Stefan Monnier
@ 2008-11-18 22:19           ` Dan Nicolaescu
  2008-11-18 23:01             ` Stefan Monnier
  2008-11-18 23:01             ` Andreas Schwab
  0 siblings, 2 replies; 39+ messages in thread
From: Dan Nicolaescu @ 2008-11-18 22:19 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 1298

Stefan Monnier <monnier@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"... 






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

* bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
  2008-11-18 22:19           ` Dan Nicolaescu
@ 2008-11-18 23:01             ` Stefan Monnier
  2008-11-18 23:27               ` Dan Nicolaescu
  2008-11-18 23:01             ` Andreas Schwab
  1 sibling, 1 reply; 39+ messages in thread
From: Stefan Monnier @ 2008-11-18 23:01 UTC (permalink / raw)
  To: Dan Nicolaescu; +Cc: 1298

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






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

* bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
  2008-11-18 22:19           ` Dan Nicolaescu
  2008-11-18 23:01             ` Stefan Monnier
@ 2008-11-18 23:01             ` Andreas Schwab
  1 sibling, 0 replies; 39+ messages in thread
From: Andreas Schwab @ 2008-11-18 23:01 UTC (permalink / raw)
  To: Dan Nicolaescu; +Cc: 1298, Stefan Monnier

Dan Nicolaescu <dann@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@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."






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

* bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
  2008-11-18 23:01             ` Stefan Monnier
@ 2008-11-18 23:27               ` Dan Nicolaescu
  2008-11-19  2:21                 ` Stefan Monnier
  0 siblings, 1 reply; 39+ messages in thread
From: Dan Nicolaescu @ 2008-11-18 23:27 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 1298

Stefan Monnier <monnier@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... 






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

* bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
  2008-11-18 23:27               ` Dan Nicolaescu
@ 2008-11-19  2:21                 ` Stefan Monnier
  2008-12-08  7:54                   ` Dan Nicolaescu
  0 siblings, 1 reply; 39+ messages in thread
From: Stefan Monnier @ 2008-11-19  2:21 UTC (permalink / raw)
  To: Dan Nicolaescu; +Cc: 1298

> 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






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

* bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
  2008-11-19  2:21                 ` Stefan Monnier
@ 2008-12-08  7:54                   ` Dan Nicolaescu
  2008-12-08 16:44                     ` Stefan Monnier
  0 siblings, 1 reply; 39+ messages in thread
From: Dan Nicolaescu @ 2008-12-08  7:54 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 1298

Stefan Monnier <monnier@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)






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

* bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
  2008-12-08  7:54                   ` Dan Nicolaescu
@ 2008-12-08 16:44                     ` Stefan Monnier
  2008-12-08 17:09                       ` Dan Nicolaescu
  0 siblings, 1 reply; 39+ messages in thread
From: Stefan Monnier @ 2008-12-08 16:44 UTC (permalink / raw)
  To: Dan Nicolaescu; +Cc: 1298

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






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

* bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
  2008-12-08 16:44                     ` Stefan Monnier
@ 2008-12-08 17:09                       ` Dan Nicolaescu
  2008-12-08 20:07                         ` Stefan Monnier
  0 siblings, 1 reply; 39+ messages in thread
From: Dan Nicolaescu @ 2008-12-08 17:09 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 1298

Stefan Monnier <monnier@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






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

* bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
  2008-12-08 17:09                       ` Dan Nicolaescu
@ 2008-12-08 20:07                         ` Stefan Monnier
  2008-12-08 20:20                           ` Dan Nicolaescu
  0 siblings, 1 reply; 39+ messages in thread
From: Stefan Monnier @ 2008-12-08 20:07 UTC (permalink / raw)
  To: Dan Nicolaescu; +Cc: 1298

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






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

* bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
  2008-12-08 20:07                         ` Stefan Monnier
@ 2008-12-08 20:20                           ` Dan Nicolaescu
  2008-12-08 21:48                             ` Stefan Monnier
  0 siblings, 1 reply; 39+ messages in thread
From: Dan Nicolaescu @ 2008-12-08 20:20 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 1298

Stefan Monnier <monnier@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







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

* bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
  2008-12-08 20:20                           ` Dan Nicolaescu
@ 2008-12-08 21:48                             ` Stefan Monnier
  2008-12-09 18:58                               ` Dan Nicolaescu
  0 siblings, 1 reply; 39+ messages in thread
From: Stefan Monnier @ 2008-12-08 21:48 UTC (permalink / raw)
  To: Dan Nicolaescu; +Cc: 1298

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






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

* bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
  2008-12-08 21:48                             ` Stefan Monnier
@ 2008-12-09 18:58                               ` Dan Nicolaescu
  2008-12-09 19:30                                 ` Juanma Barranquero
  2008-12-09 20:07                                 ` Stefan Monnier
  0 siblings, 2 replies; 39+ messages in thread
From: Dan Nicolaescu @ 2008-12-09 18:58 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 1298

Stefan Monnier <monnier@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)






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

* bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
  2008-12-09 18:58                               ` Dan Nicolaescu
@ 2008-12-09 19:30                                 ` Juanma Barranquero
  2008-12-09 20:07                                 ` Stefan Monnier
  1 sibling, 0 replies; 39+ messages in thread
From: Juanma Barranquero @ 2008-12-09 19:30 UTC (permalink / raw)
  To: Dan Nicolaescu, 1298

On Tue, Dec 9, 2008 at 19:58, Dan Nicolaescu <dann@ics.uci.edu> wrote:

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

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

    Juanma






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

* bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
  2008-12-09 18:58                               ` Dan Nicolaescu
  2008-12-09 19:30                                 ` Juanma Barranquero
@ 2008-12-09 20:07                                 ` Stefan Monnier
  2008-12-10  7:58                                   ` Dan Nicolaescu
  1 sibling, 1 reply; 39+ messages in thread
From: Stefan Monnier @ 2008-12-09 20:07 UTC (permalink / raw)
  To: Dan Nicolaescu; +Cc: 1298

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






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

* bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
  2008-12-09 20:07                                 ` Stefan Monnier
@ 2008-12-10  7:58                                   ` Dan Nicolaescu
  2008-12-10  9:49                                     ` Juanma Barranquero
  0 siblings, 1 reply; 39+ messages in thread
From: Dan Nicolaescu @ 2008-12-10  7:58 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 1298

Stefan Monnier <monnier@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.






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

* bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
  2008-12-10  7:58                                   ` Dan Nicolaescu
@ 2008-12-10  9:49                                     ` Juanma Barranquero
  2008-12-10 15:03                                       ` Dan Nicolaescu
  0 siblings, 1 reply; 39+ messages in thread
From: Juanma Barranquero @ 2008-12-10  9:49 UTC (permalink / raw)
  To: Dan Nicolaescu, 1298

On Wed, Dec 10, 2008 at 08:58, Dan Nicolaescu <dann@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






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

* bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
  2008-12-10  9:49                                     ` Juanma Barranquero
@ 2008-12-10 15:03                                       ` Dan Nicolaescu
  2008-12-10 15:10                                         ` Juanma Barranquero
  2008-12-11 16:37                                         ` Stefan Monnier
  0 siblings, 2 replies; 39+ messages in thread
From: Dan Nicolaescu @ 2008-12-10 15:03 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: 1298, Stefan Monnier

"Juanma Barranquero" <lekktu@gmail.com> writes:

  > On Wed, Dec 10, 2008 at 08:58, Dan Nicolaescu <dann@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.






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

* bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
  2008-12-10 15:03                                       ` Dan Nicolaescu
@ 2008-12-10 15:10                                         ` Juanma Barranquero
  2008-12-10 15:29                                           ` Dan Nicolaescu
  2008-12-11 16:37                                         ` Stefan Monnier
  1 sibling, 1 reply; 39+ messages in thread
From: Juanma Barranquero @ 2008-12-10 15:10 UTC (permalink / raw)
  To: Dan Nicolaescu; +Cc: 1298, Stefan Monnier

On Wed, Dec 10, 2008 at 16:03, Dan Nicolaescu <dann@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

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

* bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
  2008-12-10 15:10                                         ` Juanma Barranquero
@ 2008-12-10 15:29                                           ` Dan Nicolaescu
  2008-12-10 15:32                                             ` Juanma Barranquero
  0 siblings, 1 reply; 39+ messages in thread
From: Dan Nicolaescu @ 2008-12-10 15:29 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: 1298

"Juanma Barranquero" <lekktu@gmail.com> writes:

  > On Wed, Dec 10, 2008 at 16:03, Dan Nicolaescu <dann@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.







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

* bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
  2008-12-10 15:29                                           ` Dan Nicolaescu
@ 2008-12-10 15:32                                             ` Juanma Barranquero
  2008-12-10 15:43                                               ` Dan Nicolaescu
  0 siblings, 1 reply; 39+ messages in thread
From: Juanma Barranquero @ 2008-12-10 15:32 UTC (permalink / raw)
  To: Dan Nicolaescu; +Cc: 1298

On Wed, Dec 10, 2008 at 16:29, Dan Nicolaescu <dann@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






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

* bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
  2008-12-10 15:32                                             ` Juanma Barranquero
@ 2008-12-10 15:43                                               ` Dan Nicolaescu
  2008-12-10 15:55                                                 ` Juanma Barranquero
  0 siblings, 1 reply; 39+ messages in thread
From: Dan Nicolaescu @ 2008-12-10 15:43 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: 1298

"Juanma Barranquero" <lekktu@gmail.com> writes:

  > On Wed, Dec 10, 2008 at 16:29, Dan Nicolaescu <dann@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?






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

* bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
  2008-12-10 15:43                                               ` Dan Nicolaescu
@ 2008-12-10 15:55                                                 ` Juanma Barranquero
  0 siblings, 0 replies; 39+ messages in thread
From: Juanma Barranquero @ 2008-12-10 15:55 UTC (permalink / raw)
  To: Dan Nicolaescu; +Cc: 1298

On Wed, Dec 10, 2008 at 16:43, Dan Nicolaescu <dann@ics.uci.edu> wrote:

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

Then don't do it.

    Juanma






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

* bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
  2008-12-10 15:03                                       ` Dan Nicolaescu
  2008-12-10 15:10                                         ` Juanma Barranquero
@ 2008-12-11 16:37                                         ` Stefan Monnier
  2008-12-11 17:08                                           ` Dan Nicolaescu
  1 sibling, 1 reply; 39+ messages in thread
From: Stefan Monnier @ 2008-12-11 16:37 UTC (permalink / raw)
  To: Dan Nicolaescu; +Cc: 1298, Juanma Barranquero

> 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






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

* bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
  2008-12-11 16:37                                         ` Stefan Monnier
@ 2008-12-11 17:08                                           ` Dan Nicolaescu
  2008-12-11 19:05                                             ` Juanma Barranquero
  2008-12-11 19:06                                             ` Stefan Monnier
  0 siblings, 2 replies; 39+ messages in thread
From: Dan Nicolaescu @ 2008-12-11 17:08 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 1298, Juanma Barranquero

Stefan Monnier <monnier@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.






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

* bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
  2008-12-11 17:08                                           ` Dan Nicolaescu
@ 2008-12-11 19:05                                             ` Juanma Barranquero
  2008-12-11 19:06                                             ` Stefan Monnier
  1 sibling, 0 replies; 39+ messages in thread
From: Juanma Barranquero @ 2008-12-11 19:05 UTC (permalink / raw)
  To: Dan Nicolaescu; +Cc: 1298

On Thu, Dec 11, 2008 at 18:08, Dan Nicolaescu <dann@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






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

* bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
  2008-12-11 17:08                                           ` Dan Nicolaescu
  2008-12-11 19:05                                             ` Juanma Barranquero
@ 2008-12-11 19:06                                             ` Stefan Monnier
  2008-12-11 19:08                                               ` Juanma Barranquero
  2008-12-11 19:28                                               ` Dan Nicolaescu
  1 sibling, 2 replies; 39+ messages in thread
From: Stefan Monnier @ 2008-12-11 19:06 UTC (permalink / raw)
  To: Dan Nicolaescu; +Cc: 1298, Juanma Barranquero

> 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






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

* bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
  2008-12-11 19:06                                             ` Stefan Monnier
@ 2008-12-11 19:08                                               ` Juanma Barranquero
  2008-12-11 19:28                                               ` Dan Nicolaescu
  1 sibling, 0 replies; 39+ messages in thread
From: Juanma Barranquero @ 2008-12-11 19:08 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 1298, Dan Nicolaescu

On Thu, Dec 11, 2008 at 20:06, Stefan Monnier <monnier@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






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

* bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
  2008-12-11 19:06                                             ` Stefan Monnier
  2008-12-11 19:08                                               ` Juanma Barranquero
@ 2008-12-11 19:28                                               ` Dan Nicolaescu
  2008-12-11 19:58                                                 ` Juanma Barranquero
  2008-12-11 20:58                                                 ` Stefan Monnier
  1 sibling, 2 replies; 39+ messages in thread
From: Dan Nicolaescu @ 2008-12-11 19:28 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 1298, Juanma Barranquero

Stefan Monnier <monnier@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.






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

* bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
  2008-12-11 19:28                                               ` Dan Nicolaescu
@ 2008-12-11 19:58                                                 ` Juanma Barranquero
  2008-12-11 20:39                                                   ` Dan Nicolaescu
  2008-12-11 20:58                                                 ` Stefan Monnier
  1 sibling, 1 reply; 39+ messages in thread
From: Juanma Barranquero @ 2008-12-11 19:58 UTC (permalink / raw)
  To: Dan Nicolaescu; +Cc: 1298

On Thu, Dec 11, 2008 at 20:28, Dan Nicolaescu <dann@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






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

* bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
  2008-12-11 19:58                                                 ` Juanma Barranquero
@ 2008-12-11 20:39                                                   ` Dan Nicolaescu
  2008-12-11 20:48                                                     ` Juanma Barranquero
  0 siblings, 1 reply; 39+ messages in thread
From: Dan Nicolaescu @ 2008-12-11 20:39 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: 1298

"Juanma Barranquero" <lekktu@gmail.com> writes:

  > On Thu, Dec 11, 2008 at 20:28, Dan Nicolaescu <dann@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.






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

* bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
  2008-12-11 20:39                                                   ` Dan Nicolaescu
@ 2008-12-11 20:48                                                     ` Juanma Barranquero
  0 siblings, 0 replies; 39+ messages in thread
From: Juanma Barranquero @ 2008-12-11 20:48 UTC (permalink / raw)
  To: Dan Nicolaescu; +Cc: 1298

On Thu, Dec 11, 2008 at 21:39, Dan Nicolaescu <dann@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






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

* bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
  2008-12-11 19:28                                               ` Dan Nicolaescu
  2008-12-11 19:58                                                 ` Juanma Barranquero
@ 2008-12-11 20:58                                                 ` Stefan Monnier
  1 sibling, 0 replies; 39+ messages in thread
From: Stefan Monnier @ 2008-12-11 20:58 UTC (permalink / raw)
  To: Dan Nicolaescu; +Cc: 1298, Juanma Barranquero

This discussion is pointless and hence over.


        Stefan


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

> Stefan Monnier <monnier@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.






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

* bug#1298: marked as done (allow 'emacsclient -a "emacs --daemon  && emacsclient -c"')
  2008-11-02 18:18 ` bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"' Dan Nicolaescu
  2008-11-18  8:22   ` Dan Nicolaescu
@ 2008-12-11 21:25   ` Emacs bug Tracking System
  1 sibling, 0 replies; 39+ messages in thread
From: Emacs bug Tracking System @ 2008-12-11 21:25 UTC (permalink / raw)
  To: Dan Nicolaescu

[-- Attachment #1: Type: text/plain, Size: 912 bytes --]


Your message dated Thu, 11 Dec 2008 13:23:16 -0800 (PST)
with message-id <200812112123.mBBLNGpI001493@mothra.ics.uci.edu>
and subject line Re: bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
has caused the Emacs bug report #1298,
regarding allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact don@donarmstrong.com
immediately.)


-- 
1298: http://emacsbugs.donarmstrong.com/cgi-bin/bugreport.cgi?bug=1298
Emacs Bug Tracking System
Contact don@donarmstrong.com with problems

[-- Attachment #2: Type: message/rfc822, Size: 2563 bytes --]

From: Dan Nicolaescu <dann@ics.uci.edu>
To: bug-gnu-emacs <bug-gnu-emacs@gnu.org>
Subject: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
Date: Sun, 2 Nov 2008 10:18:15 -0800 (PST)
Message-ID: <200811021818.mA2IIFMq028772@mothra.ics.uci.edu>


It would be nice if some equivalent of: 

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

would work.

That would allow one to ALWAYS use emacsclient. 




[-- Attachment #3: Type: message/rfc822, Size: 2701 bytes --]

From: Dan Nicolaescu <dann@ics.uci.edu>
To: 1298-done@emacsbugs.donarmstrong.com
Subject: Re: bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"'
Date: Thu, 11 Dec 2008 13:23:16 -0800 (PST)
Message-ID: <200812112123.mBBLNGpI001493@mothra.ics.uci.edu>

Fixed.


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

end of thread, other threads:[~2008-12-11 21:25 UTC | newest]

Thread overview: 39+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <200812112123.mBBLNGpI001493@mothra.ics.uci.edu>
2008-11-02 18:18 ` bug#1298: allow 'emacsclient -a "emacs --daemon && emacsclient -c"' Dan Nicolaescu
2008-11-18  8:22   ` Dan Nicolaescu
2008-11-18 16:36     ` Stefan Monnier
2008-11-18 18:17       ` Dan Nicolaescu
2008-11-18 21:34         ` Stefan Monnier
2008-11-18 22:19           ` Dan Nicolaescu
2008-11-18 23:01             ` Stefan Monnier
2008-11-18 23:27               ` Dan Nicolaescu
2008-11-19  2:21                 ` Stefan Monnier
2008-12-08  7:54                   ` Dan Nicolaescu
2008-12-08 16:44                     ` Stefan Monnier
2008-12-08 17:09                       ` Dan Nicolaescu
2008-12-08 20:07                         ` Stefan Monnier
2008-12-08 20:20                           ` Dan Nicolaescu
2008-12-08 21:48                             ` Stefan Monnier
2008-12-09 18:58                               ` Dan Nicolaescu
2008-12-09 19:30                                 ` Juanma Barranquero
2008-12-09 20:07                                 ` Stefan Monnier
2008-12-10  7:58                                   ` Dan Nicolaescu
2008-12-10  9:49                                     ` Juanma Barranquero
2008-12-10 15:03                                       ` Dan Nicolaescu
2008-12-10 15:10                                         ` Juanma Barranquero
2008-12-10 15:29                                           ` Dan Nicolaescu
2008-12-10 15:32                                             ` Juanma Barranquero
2008-12-10 15:43                                               ` Dan Nicolaescu
2008-12-10 15:55                                                 ` Juanma Barranquero
2008-12-11 16:37                                         ` Stefan Monnier
2008-12-11 17:08                                           ` Dan Nicolaescu
2008-12-11 19:05                                             ` Juanma Barranquero
2008-12-11 19:06                                             ` Stefan Monnier
2008-12-11 19:08                                               ` Juanma Barranquero
2008-12-11 19:28                                               ` Dan Nicolaescu
2008-12-11 19:58                                                 ` Juanma Barranquero
2008-12-11 20:39                                                   ` Dan Nicolaescu
2008-12-11 20:48                                                     ` Juanma Barranquero
2008-12-11 20:58                                                 ` Stefan Monnier
2008-11-18 23:01             ` Andreas Schwab
2008-11-18 19:43     ` Eli Zaretskii
2008-12-11 21:25   ` bug#1298: marked as done (allow 'emacsclient -a "emacs --daemon && emacsclient -c"') Emacs bug Tracking System

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).