1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-13 16:38:14 +00:00

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 <usenet@siart.de> 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.
This commit is contained in:
Juanma Barranquero 2011-12-04 18:13:01 +01:00
parent ec7ae0329e
commit 520fca41d6
4 changed files with 43 additions and 14 deletions

View File

@ -1,3 +1,11 @@
2011-12-04 Juanma Barranquero <lekktu@gmail.com>
* 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 <usenet@siart.de> in this thread:
http://lists.gnu.org/archive/html/emacs-devel/2011-11/msg00303.html
2011-11-30 Chong Yidong <cyd@gnu.org>
* emacsclient.c (main): Condition last change on WINDOWSNT

View File

@ -638,6 +638,22 @@ 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;
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 @@ decode_options (int argc, char **argv)
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 */
}

View File

@ -1,3 +1,10 @@
2011-12-04 Juanma Barranquero <lekktu@gmail.com>
* 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 <rgm@gnu.org>
* textmodes/texinfmt.el (batch-texinfo-format): Doc fix. (Bug#10207)

View File

@ -307,11 +307,13 @@ Updates `server-clients'."
(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 @@ The following commands are accepted by the client:
(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.