diff options
| author | Juanma Barranquero | 2011-12-04 18:13:01 +0100 |
|---|---|---|
| committer | Juanma Barranquero | 2011-12-04 18:13:01 +0100 |
| commit | 520fca41d6ca6cc860c1f03c76cd472ea149e33a (patch) | |
| tree | ae940593c2033d55da3e51b113a12bca88a9e816 | |
| parent | ec7ae0329e5cfda066433f8c5d5daa6e0d1dde14 (diff) | |
| download | emacs-520fca41d6ca6cc860c1f03c76cd472ea149e33a.tar.gz emacs-520fca41d6ca6cc860c1f03c76cd472ea149e33a.zip | |
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.
| -rw-r--r-- | lib-src/ChangeLog | 8 | ||||
| -rw-r--r-- | lib-src/emacsclient.c | 24 | ||||
| -rw-r--r-- | lisp/ChangeLog | 7 | ||||
| -rw-r--r-- | lisp/server.el | 18 |
4 files changed, 43 insertions, 14 deletions
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog index 1eb67eb6c71..922a96ad194 100644 --- a/lib-src/ChangeLog +++ b/lib-src/ChangeLog | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 2011-12-04 Juanma Barranquero <lekktu@gmail.com> | ||
| 2 | |||
| 3 | * emacsclient.c (decode_options) [WINDOWSNT]: Don't force tty = 0; | ||
| 4 | instead, treat both -c and -t as always requesting a new "tty" frame, | ||
| 5 | and let server.el decide which kind is actually required. | ||
| 6 | Reported by Uwe Siart <usenet@siart.de> in this thread: | ||
| 7 | http://lists.gnu.org/archive/html/emacs-devel/2011-11/msg00303.html | ||
| 8 | |||
| 1 | 2011-11-30 Chong Yidong <cyd@gnu.org> | 9 | 2011-11-30 Chong Yidong <cyd@gnu.org> |
| 2 | 10 | ||
| 3 | * emacsclient.c (main): Condition last change on WINDOWSNT | 11 | * emacsclient.c (main): Condition last change on WINDOWSNT |
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c index 0ae1f0bddea..5e1c2d61b89 100644 --- a/lib-src/emacsclient.c +++ b/lib-src/emacsclient.c | |||
| @@ -638,6 +638,22 @@ decode_options (int argc, char **argv) | |||
| 638 | if (display && strlen (display) == 0) | 638 | if (display && strlen (display) == 0) |
| 639 | display = NULL; | 639 | display = NULL; |
| 640 | 640 | ||
| 641 | #ifdef WINDOWSNT | ||
| 642 | /* Emacs on Windows does not support GUI and console frames in the same | ||
| 643 | instance. So, it makes sense to treat the -t and -c options as | ||
| 644 | equivalent, and open a new frame regardless of whether the running | ||
| 645 | instance is GUI or console. Ideally, we would only set tty = 1 when | ||
| 646 | the instance is running in a console, but alas we don't know that. | ||
| 647 | The simplest workaround is to always ask for a tty frame, and let | ||
| 648 | server.el check whether it makes sense. */ | ||
| 649 | if (tty || !current_frame) | ||
| 650 | { | ||
| 651 | display = (const char *) ttyname; | ||
| 652 | current_frame = 0; | ||
| 653 | tty = 1; | ||
| 654 | } | ||
| 655 | #endif | ||
| 656 | |||
| 641 | /* If no display is available, new frames are tty frames. */ | 657 | /* If no display is available, new frames are tty frames. */ |
| 642 | if (!current_frame && !display) | 658 | if (!current_frame && !display) |
| 643 | tty = 1; | 659 | tty = 1; |
| @@ -654,14 +670,6 @@ decode_options (int argc, char **argv) | |||
| 654 | an empty string"); | 670 | an empty string"); |
| 655 | exit (EXIT_FAILURE); | 671 | exit (EXIT_FAILURE); |
| 656 | } | 672 | } |
| 657 | |||
| 658 | /* TTY frames not supported on Windows. Continue using GUI rather than | ||
| 659 | forcing the user to change their command-line. This is required since | ||
| 660 | tty is set above if certain options are given and $DISPLAY is not set, | ||
| 661 | which is not obvious to users. */ | ||
| 662 | if (tty) | ||
| 663 | tty = 0; | ||
| 664 | |||
| 665 | #endif /* WINDOWSNT */ | 673 | #endif /* WINDOWSNT */ |
| 666 | } | 674 | } |
| 667 | 675 | ||
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index c77ace6d483..3d09a225da0 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2011-12-04 Juanma Barranquero <lekktu@gmail.com> | ||
| 2 | |||
| 3 | * server.el (server-delete-client): On Windows, do not try to delete | ||
| 4 | the only terminal. | ||
| 5 | (server-process-filter): On Windows, treat requests for a tty frame as | ||
| 6 | if they were for a GUI frame if the running server is in GUI mode. | ||
| 7 | |||
| 1 | 2011-12-03 Glenn Morris <rgm@gnu.org> | 8 | 2011-12-03 Glenn Morris <rgm@gnu.org> |
| 2 | 9 | ||
| 3 | * textmodes/texinfmt.el (batch-texinfo-format): Doc fix. (Bug#10207) | 10 | * textmodes/texinfmt.el (batch-texinfo-format): Doc fix. (Bug#10207) |
diff --git a/lisp/server.el b/lisp/server.el index e02f63a8268..edd8f2afa93 100644 --- a/lisp/server.el +++ b/lisp/server.el | |||
| @@ -307,11 +307,13 @@ Updates `server-clients'." | |||
| 307 | 307 | ||
| 308 | (setq server-clients (delq proc server-clients)) | 308 | (setq server-clients (delq proc server-clients)) |
| 309 | 309 | ||
| 310 | ;; Delete the client's tty. | 310 | ;; Delete the client's tty, except on Windows (both GUI and console), |
| 311 | (let ((terminal (process-get proc 'terminal))) | 311 | ;; where there's only one terminal and does not make sense to delete it. |
| 312 | ;; Only delete the terminal if it is non-nil. | 312 | (unless (eq system-type 'windows-nt) |
| 313 | (when (and terminal (eq (terminal-live-p terminal) t)) | 313 | (let ((terminal (process-get proc 'terminal))) |
| 314 | (delete-terminal terminal))) | 314 | ;; Only delete the terminal if it is non-nil. |
| 315 | (when (and terminal (eq (terminal-live-p terminal) t)) | ||
| 316 | (delete-terminal terminal)))) | ||
| 315 | 317 | ||
| 316 | ;; Delete the client's process. | 318 | ;; Delete the client's process. |
| 317 | (if (eq (process-status proc) 'open) | 319 | (if (eq (process-status proc) 'open) |
| @@ -1035,7 +1037,11 @@ The following commands are accepted by the client: | |||
| 1035 | (setq tty-name (pop args-left) | 1037 | (setq tty-name (pop args-left) |
| 1036 | tty-type (pop args-left) | 1038 | tty-type (pop args-left) |
| 1037 | dontkill (or dontkill | 1039 | dontkill (or dontkill |
| 1038 | (not use-current-frame)))) | 1040 | (not use-current-frame))) |
| 1041 | ;; On Windows, emacsclient always asks for a tty frame. | ||
| 1042 | ;; If running a GUI server, force the frame type to GUI. | ||
| 1043 | (when (eq window-system 'w32) | ||
| 1044 | (push "-window-system" args-left))) | ||
| 1039 | 1045 | ||
| 1040 | ;; -position LINE[:COLUMN]: Set point to the given | 1046 | ;; -position LINE[:COLUMN]: Set point to the given |
| 1041 | ;; position in the next file. | 1047 | ;; position in the next file. |