]> git.eshelyaron.com Git - emacs.git/commitdiff
Move "emacsclient -t -n" handling from emacsclient.c to server.el.
authorChong Yidong <cyd@gnu.org>
Sun, 15 Apr 2012 08:49:24 +0000 (16:49 +0800)
committerChong Yidong <cyd@gnu.org>
Sun, 15 Apr 2012 08:49:24 +0000 (16:49 +0800)
Fix its buggy logic for the Windows case (regression from 23.4).

* lib-src/emacsclient.c (decode_options): Move -t -n corner case handling
into server.el.

* lisp/server.el (server-process-filter): Handle corner case where both
tty and nowait options are present.

Fixes: debbugs:11102
lib-src/ChangeLog
lib-src/emacsclient.c
lisp/ChangeLog
lisp/server.el

index dd10026447fd7ff781fe7a9b91e91dc9c2207999..e58b291ec896b954a65d2b8c4ddc878d06979e1f 100644 (file)
@@ -1,3 +1,8 @@
+2012-04-15  Chong Yidong  <cyd@gnu.org>
+
+       * emacsclient.c (decode_options): Move -t -n corner case handling
+       into server.el (Bug#11102).
+
 2012-04-12  Juanma Barranquero  <lekktu@gmail.com>
 
        * emacsclient.c (decode_options) [WINDOWSNT]:
index 05fd0f3515e718564d0e8ba84096b77d0b3dc231..48b4384d4875f948ddd4d251204c71abe841d5ae 100644 (file)
@@ -638,32 +638,23 @@ decode_options (int argc, char **argv)
   if (display && strlen (display) == 0)
     display = NULL;
 
-#ifdef WINDOWSNT
-  /* Emacs on Windows does not support GUI and console frames in the same
-     instance.  So, it makes sense to treat the -t and -c options as
-     equivalent, and open a new frame regardless of whether the running
-     instance is GUI or console.  Ideally, we would only set tty = 1 when
-     the instance is running in a console, but alas we don't know that.
-     The simplest workaround is to always ask for a tty frame, and let
-     server.el check whether it makes sense.  */
-  if (tty || !current_frame)
-    {
-      display = (const char *) ttyname (0);  /* Arg is ignored.  */
-      current_frame = 0;
-      tty = 1;
-    }
-#endif
-
   /* If no display is available, new frames are tty frames.  */
   if (!current_frame && !display)
     tty = 1;
 
-  /* --no-wait implies --current-frame on ttys when there are file
-     arguments or expressions given.  */
-  if (nowait && tty && argc - optind > 0)
-    current_frame = 1;
-
 #ifdef WINDOWSNT
+  /* Emacs on Windows does not support graphical and text terminal
+     frames in the same instance.  So, treat the -t and -c options as
+     equivalent, and open a new frame on the server's terminal.
+     Ideally, we would only set tty = 1 when the serve is running in a
+     console, but alas we don't know that.  As a workaround, always
+     ask for a tty frame, and let server.el figure it out.  */
+  if (!current_frame)
+    {
+      display = NULL;
+      tty = 1;
+    }
+
   if (alternate_editor && alternate_editor[0] == '\0')
     {
       message (TRUE, "--alternate-editor argument or ALTERNATE_EDITOR variable cannot be\n\
index 8c9f5b9f035a85f7c1fd51c31ede91aa93eb2031..db559581ec2d7af2daea34aa298fe0841d041bcd 100644 (file)
@@ -1,3 +1,8 @@
+2012-04-15  Chong Yidong  <cyd@gnu.org>
+
+       * server.el (server-process-filter): Handle corner case where both
+       tty and nowait options are present (Bug#11102).
+
 2012-04-15  Glenn Morris  <rgm@gnu.org>
 
        * simple.el (process-file-side-effects): Doc fix.
index 404bebc47478ef6dc0e63fa17b007d59c61dc553..ced07714dcf2945d964b554ed90d467dda4b2768 100644 (file)
@@ -1133,6 +1133,13 @@ The following commands are accepted by the client:
                 ;; Unknown command.
                 (arg (error "Unknown command: %s" arg))))
 
+           ;; If both -no-wait and -tty are given with file or sexp
+           ;; arguments, use an existing frame.
+           (and nowait
+                (not (eq tty-name 'window-system))
+                (or files commands)
+                (setq use-current-frame t))
+
            (setq frame
                  (cond
                   ((and use-current-frame