diff options
| author | Chong Yidong | 2008-10-30 15:50:01 +0000 |
|---|---|---|
| committer | Chong Yidong | 2008-10-30 15:50:01 +0000 |
| commit | cd9c54eb5fb23f1ef825eeced60e5c9ab8f0c93e (patch) | |
| tree | 6858809395b10f56360d337f5111e044fc559a03 | |
| parent | 89c4b597aa5a035bb596ddb39680c1e38185888f (diff) | |
| download | emacs-cd9c54eb5fb23f1ef825eeced60e5c9ab8f0c93e.tar.gz emacs-cd9c54eb5fb23f1ef825eeced60e5c9ab8f0c93e.zip | |
(server-process-filter): In daemon mode, default to emacsclient's tty
if not opening a new frame and only the terminal-frame is available.
| -rw-r--r-- | lisp/server.el | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/lisp/server.el b/lisp/server.el index 57d23183d2c..ae1202e9e9e 100644 --- a/lisp/server.el +++ b/lisp/server.el | |||
| @@ -810,6 +810,7 @@ The following commands are accepted by the client: | |||
| 810 | dontkill ; t if the client should not be killed. | 810 | dontkill ; t if the client should not be killed. |
| 811 | (commands ()) | 811 | (commands ()) |
| 812 | dir | 812 | dir |
| 813 | use-current-frame | ||
| 813 | (tty-name nil) ;nil, `window-system', or the tty name. | 814 | (tty-name nil) ;nil, `window-system', or the tty name. |
| 814 | tty-type ;string. | 815 | tty-type ;string. |
| 815 | (files nil) | 816 | (files nil) |
| @@ -830,7 +831,7 @@ The following commands are accepted by the client: | |||
| 830 | ((equal "-nowait" arg) (setq nowait t)) | 831 | ((equal "-nowait" arg) (setq nowait t)) |
| 831 | 832 | ||
| 832 | ;; -current-frame: Don't create frames. | 833 | ;; -current-frame: Don't create frames. |
| 833 | ((equal "-current-frame" arg) (setq tty-name nil)) | 834 | ((equal "-current-frame" arg) (setq use-current-frame t)) |
| 834 | 835 | ||
| 835 | ;; -display DISPLAY: | 836 | ;; -display DISPLAY: |
| 836 | ;; Open X frames on the given display instead of the default. | 837 | ;; Open X frames on the given display instead of the default. |
| @@ -874,7 +875,8 @@ The following commands are accepted by the client: | |||
| 874 | (cdr command-line-args-left)) | 875 | (cdr command-line-args-left)) |
| 875 | (setq tty-name (pop command-line-args-left) | 876 | (setq tty-name (pop command-line-args-left) |
| 876 | tty-type (pop command-line-args-left) | 877 | tty-type (pop command-line-args-left) |
| 877 | dontkill t)) | 878 | dontkill (or dontkill |
| 879 | (not use-current-frame)))) | ||
| 878 | 880 | ||
| 879 | ;; -position LINE[:COLUMN]: Set point to the given | 881 | ;; -position LINE[:COLUMN]: Set point to the given |
| 880 | ;; position in the next file. | 882 | ;; position in the next file. |
| @@ -902,6 +904,8 @@ The following commands are accepted by the client: | |||
| 902 | ;; -eval EXPR: Evaluate a Lisp expression. | 904 | ;; -eval EXPR: Evaluate a Lisp expression. |
| 903 | ((and (equal "-eval" arg) | 905 | ((and (equal "-eval" arg) |
| 904 | command-line-args-left) | 906 | command-line-args-left) |
| 907 | (if use-current-frame | ||
| 908 | (setq use-current-frame 'always)) | ||
| 905 | (lexical-let ((expr (pop command-line-args-left))) | 909 | (lexical-let ((expr (pop command-line-args-left))) |
| 906 | (if coding-system | 910 | (if coding-system |
| 907 | (setq expr (decode-coding-string expr coding-system))) | 911 | (setq expr (decode-coding-string expr coding-system))) |
| @@ -926,12 +930,20 @@ The following commands are accepted by the client: | |||
| 926 | ;; Unknown command. | 930 | ;; Unknown command. |
| 927 | (t (error "Unknown command: %s" arg)))) | 931 | (t (error "Unknown command: %s" arg)))) |
| 928 | 932 | ||
| 929 | (setq frame | 933 | (setq frame |
| 930 | (case tty-name | 934 | (cond |
| 931 | ((nil) (if display (server-select-display display))) | 935 | ((and use-current-frame |
| 932 | ((window-system) | 936 | (or (eq use-current-frame 'always) |
| 933 | (server-create-window-system-frame display nowait proc)) | 937 | ;; We can't use the Emacs daemon's |
| 934 | (t (server-create-tty-frame tty-name tty-type proc)))) | 938 | ;; terminal frame. |
| 939 | (not (and (= (length (frame-list)) 1) | ||
| 940 | (eq (selected-frame) | ||
| 941 | terminal-frame))))) | ||
| 942 | (setq tty-name nil) | ||
| 943 | (if display (server-select-display display))) | ||
| 944 | ((eq tty-name 'window-system) | ||
| 945 | (server-create-window-system-frame display nowait proc)) | ||
| 946 | (t (server-create-tty-frame tty-name tty-type proc)))) | ||
| 935 | 947 | ||
| 936 | (process-put | 948 | (process-put |
| 937 | proc 'continuation | 949 | proc 'continuation |