emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r106608: Fix emacsclient bug where "-


From: Juanma Barranquero
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r106608: Fix emacsclient bug where "-n -c" does not open a new frame on Windows.
Date: Sun, 04 Dec 2011 18:13:01 +0100
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 106608
committer: Juanma Barranquero <address@hidden>
branch nick: trunk
timestamp: Sun 2011-12-04 18:13:01 +0100
message:
  Fix emacsclient bug where "-n -c" does not open a new frame on Windows.
  
  * lib-src/emacsclient.c (decode_options) [WINDOWSNT]: Don't force tty = 0;
  instead, treat both -c and -t as always requesting a new "tty" frame,
  and let server.el decide which kind is actually required.
  Reported by Uwe Siart <address@hidden> in this thread:
  http://lists.gnu.org/archive/html/emacs-devel/2011-11/msg00303.html
  
  * lisp/server.el (server-delete-client): On Windows, do not try to delete
  the only terminal.
  (server-process-filter): On Windows, treat requests for a tty frame as
  if they were for a GUI frame if the running server is in GUI mode.
modified:
  lib-src/ChangeLog
  lib-src/emacsclient.c
  lisp/ChangeLog
  lisp/server.el
=== modified file 'lib-src/ChangeLog'
--- a/lib-src/ChangeLog 2011-11-30 08:13:05 +0000
+++ b/lib-src/ChangeLog 2011-12-04 17:13:01 +0000
@@ -1,3 +1,11 @@
+2011-12-04  Juanma Barranquero  <address@hidden>
+
+       * emacsclient.c (decode_options) [WINDOWSNT]: Don't force tty = 0;
+       instead, treat both -c and -t as always requesting a new "tty" frame,
+       and let server.el decide which kind is actually required.
+       Reported by Uwe Siart <address@hidden> in this thread:
+       http://lists.gnu.org/archive/html/emacs-devel/2011-11/msg00303.html
+
 2011-11-30  Chong Yidong  <address@hidden>
 
        * emacsclient.c (main): Condition last change on WINDOWSNT

=== modified file 'lib-src/emacsclient.c'
--- a/lib-src/emacsclient.c     2011-11-30 15:43:33 +0000
+++ b/lib-src/emacsclient.c     2011-12-04 17:13:01 +0000
@@ -638,6 +638,22 @@
   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;
+      current_frame = 0;
+      tty = 1;
+    }
+#endif
+
   /* If no display is available, new frames are tty frames.  */
   if (!current_frame && !display)
     tty = 1;
@@ -654,14 +670,6 @@
 an empty string");
       exit (EXIT_FAILURE);
     }
-
-  /* TTY frames not supported on Windows.  Continue using GUI rather than
-     forcing the user to change their command-line.  This is required since
-     tty is set above if certain options are given and $DISPLAY is not set,
-     which is not obvious to users.  */
-  if (tty)
-      tty = 0;
-
 #endif /* WINDOWSNT */
 }
 

=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2011-12-03 20:44:19 +0000
+++ b/lisp/ChangeLog    2011-12-04 17:13:01 +0000
@@ -1,3 +1,10 @@
+2011-12-04  Juanma Barranquero  <address@hidden>
+
+       * server.el (server-delete-client): On Windows, do not try to delete
+       the only terminal.
+       (server-process-filter): On Windows, treat requests for a tty frame as
+       if they were for a GUI frame if the running server is in GUI mode.
+
 2011-12-03  Glenn Morris  <address@hidden>
 
        * textmodes/texinfmt.el (batch-texinfo-format): Doc fix.  (Bug#10207)

=== modified file 'lisp/server.el'
--- a/lisp/server.el    2011-11-22 15:18:56 +0000
+++ b/lisp/server.el    2011-12-04 17:13:01 +0000
@@ -307,11 +307,13 @@
 
       (setq server-clients (delq proc server-clients))
 
-      ;; Delete the client's tty.
-      (let ((terminal (process-get proc 'terminal)))
-       ;; Only delete the terminal if it is non-nil.
-       (when (and terminal (eq (terminal-live-p terminal) t))
-         (delete-terminal terminal)))
+      ;; Delete the client's tty, except on Windows (both GUI and console),
+      ;; where there's only one terminal and does not make sense to delete it.
+      (unless (eq system-type 'windows-nt)
+       (let ((terminal (process-get proc 'terminal)))
+         ;; Only delete the terminal if it is non-nil.
+         (when (and terminal (eq (terminal-live-p terminal) t))
+           (delete-terminal terminal))))
 
       ;; Delete the client's process.
       (if (eq (process-status proc) 'open)
@@ -1035,7 +1037,11 @@
                  (setq tty-name (pop args-left)
                        tty-type (pop args-left)
                        dontkill (or dontkill
-                                    (not use-current-frame))))
+                                    (not use-current-frame)))
+                 ;; On Windows, emacsclient always asks for a tty frame.
+                 ;; If running a GUI server, force the frame type to GUI.
+                 (when (eq window-system 'w32)
+                   (push "-window-system" args-left)))
 
                 ;; -position LINE[:COLUMN]:  Set point to the given
                 ;;  position in the next file.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]