diff options
| author | Chong Yidong | 2012-04-15 16:49:24 +0800 |
|---|---|---|
| committer | Chong Yidong | 2012-04-15 16:49:24 +0800 |
| commit | 9a864fa27d1bdc85c3542d34e6a2fc02fe03c718 (patch) | |
| tree | dae3f52efe9b0d03a5ccf974b4bd5c22f075ba4a | |
| parent | 467a33d09f0e6d445fb020013ac65b12adffc35e (diff) | |
| download | emacs-9a864fa27d1bdc85c3542d34e6a2fc02fe03c718.tar.gz emacs-9a864fa27d1bdc85c3542d34e6a2fc02fe03c718.zip | |
Move "emacsclient -t -n" handling from emacsclient.c to server.el.
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
| -rw-r--r-- | lib-src/ChangeLog | 5 | ||||
| -rw-r--r-- | lib-src/emacsclient.c | 33 | ||||
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/server.el | 7 |
4 files changed, 29 insertions, 21 deletions
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog index dd10026447f..e58b291ec89 100644 --- a/lib-src/ChangeLog +++ b/lib-src/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2012-04-15 Chong Yidong <cyd@gnu.org> | ||
| 2 | |||
| 3 | * emacsclient.c (decode_options): Move -t -n corner case handling | ||
| 4 | into server.el (Bug#11102). | ||
| 5 | |||
| 1 | 2012-04-12 Juanma Barranquero <lekktu@gmail.com> | 6 | 2012-04-12 Juanma Barranquero <lekktu@gmail.com> |
| 2 | 7 | ||
| 3 | * emacsclient.c (decode_options) [WINDOWSNT]: | 8 | * emacsclient.c (decode_options) [WINDOWSNT]: |
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c index 05fd0f3515e..48b4384d487 100644 --- a/lib-src/emacsclient.c +++ b/lib-src/emacsclient.c | |||
| @@ -638,32 +638,23 @@ 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 (0); /* Arg is ignored. */ | ||
| 652 | current_frame = 0; | ||
| 653 | tty = 1; | ||
| 654 | } | ||
| 655 | #endif | ||
| 656 | |||
| 657 | /* If no display is available, new frames are tty frames. */ | 641 | /* If no display is available, new frames are tty frames. */ |
| 658 | if (!current_frame && !display) | 642 | if (!current_frame && !display) |
| 659 | tty = 1; | 643 | tty = 1; |
| 660 | 644 | ||
| 661 | /* --no-wait implies --current-frame on ttys when there are file | ||
| 662 | arguments or expressions given. */ | ||
| 663 | if (nowait && tty && argc - optind > 0) | ||
| 664 | current_frame = 1; | ||
| 665 | |||
| 666 | #ifdef WINDOWSNT | 645 | #ifdef WINDOWSNT |
| 646 | /* Emacs on Windows does not support graphical and text terminal | ||
| 647 | frames in the same instance. So, treat the -t and -c options as | ||
| 648 | equivalent, and open a new frame on the server's terminal. | ||
| 649 | Ideally, we would only set tty = 1 when the serve is running in a | ||
| 650 | console, but alas we don't know that. As a workaround, always | ||
| 651 | ask for a tty frame, and let server.el figure it out. */ | ||
| 652 | if (!current_frame) | ||
| 653 | { | ||
| 654 | display = NULL; | ||
| 655 | tty = 1; | ||
| 656 | } | ||
| 657 | |||
| 667 | if (alternate_editor && alternate_editor[0] == '\0') | 658 | if (alternate_editor && alternate_editor[0] == '\0') |
| 668 | { | 659 | { |
| 669 | message (TRUE, "--alternate-editor argument or ALTERNATE_EDITOR variable cannot be\n\ | 660 | message (TRUE, "--alternate-editor argument or ALTERNATE_EDITOR variable cannot be\n\ |
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 8c9f5b9f035..db559581ec2 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2012-04-15 Chong Yidong <cyd@gnu.org> | ||
| 2 | |||
| 3 | * server.el (server-process-filter): Handle corner case where both | ||
| 4 | tty and nowait options are present (Bug#11102). | ||
| 5 | |||
| 1 | 2012-04-15 Glenn Morris <rgm@gnu.org> | 6 | 2012-04-15 Glenn Morris <rgm@gnu.org> |
| 2 | 7 | ||
| 3 | * simple.el (process-file-side-effects): Doc fix. | 8 | * simple.el (process-file-side-effects): Doc fix. |
diff --git a/lisp/server.el b/lisp/server.el index 404bebc4747..ced07714dcf 100644 --- a/lisp/server.el +++ b/lisp/server.el | |||
| @@ -1133,6 +1133,13 @@ The following commands are accepted by the client: | |||
| 1133 | ;; Unknown command. | 1133 | ;; Unknown command. |
| 1134 | (arg (error "Unknown command: %s" arg)))) | 1134 | (arg (error "Unknown command: %s" arg)))) |
| 1135 | 1135 | ||
| 1136 | ;; If both -no-wait and -tty are given with file or sexp | ||
| 1137 | ;; arguments, use an existing frame. | ||
| 1138 | (and nowait | ||
| 1139 | (not (eq tty-name 'window-system)) | ||
| 1140 | (or files commands) | ||
| 1141 | (setq use-current-frame t)) | ||
| 1142 | |||
| 1136 | (setq frame | 1143 | (setq frame |
| 1137 | (cond | 1144 | (cond |
| 1138 | ((and use-current-frame | 1145 | ((and use-current-frame |