diff options
| author | Eliza Velasquez | 2020-11-10 22:14:03 -0500 |
|---|---|---|
| committer | Stefan Monnier | 2020-11-10 22:14:03 -0500 |
| commit | 47f33e6cb0498f2405957539efcb8bd174c602ff (patch) | |
| tree | 8322e017c93803ebd250eb581e3cb4a7e2173787 | |
| parent | 79d04ae13ff33a93f631061d912168e9703251dd (diff) | |
| download | emacs-47f33e6cb0498f2405957539efcb8bd174c602ff.tar.gz emacs-47f33e6cb0498f2405957539efcb8bd174c602ff.zip | |
* lisp/server.el: Fix frame creation on dumb terminals (bug#25547)
(server-create-dumb-terminal-frame): New function.
(server-process-filter): Use it.
(server-delete-client): Don't delete tty terminal when it's not
exclusive to this client.
| -rw-r--r-- | lisp/server.el | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/lisp/server.el b/lisp/server.el index a660deab8e8..734fb8a34ac 100644 --- a/lisp/server.el +++ b/lisp/server.el | |||
| @@ -354,9 +354,11 @@ Updates `server-clients'." | |||
| 354 | 354 | ||
| 355 | (setq server-clients (delq proc server-clients)) | 355 | (setq server-clients (delq proc server-clients)) |
| 356 | 356 | ||
| 357 | ;; Delete the client's tty, except on Windows (both GUI and console), | 357 | ;; Delete the client's tty, except on Windows (both GUI and |
| 358 | ;; where there's only one terminal and does not make sense to delete it. | 358 | ;; console), where there's only one terminal and does not make |
| 359 | (unless (eq system-type 'windows-nt) | 359 | ;; sense to delete it, or if we are explicitly told not. |
| 360 | (unless (or (eq system-type 'windows-nt) | ||
| 361 | (process-get proc 'no-delete-terminal)) | ||
| 360 | (let ((terminal (process-get proc 'terminal))) | 362 | (let ((terminal (process-get proc 'terminal))) |
| 361 | ;; Only delete the terminal if it is non-nil. | 363 | ;; Only delete the terminal if it is non-nil. |
| 362 | (when (and terminal (eq (terminal-live-p terminal) t)) | 364 | (when (and terminal (eq (terminal-live-p terminal) t)) |
| @@ -918,6 +920,19 @@ This handles splitting the command if it would be bigger than | |||
| 918 | (server-send-string proc "-window-system-unsupported \n") | 920 | (server-send-string proc "-window-system-unsupported \n") |
| 919 | nil)))) | 921 | nil)))) |
| 920 | 922 | ||
| 923 | (defun server-create-dumb-terminal-frame (nowait proc &optional parameters) | ||
| 924 | (add-to-list 'frame-inherited-parameters 'client) | ||
| 925 | (let ((frame (make-frame `((client . ,(if nowait 'nowait proc)) | ||
| 926 | ;; This is a leftover, see above. | ||
| 927 | (environment . ,(process-get proc 'env)) | ||
| 928 | ,@parameters)))) | ||
| 929 | (server-log (format "%s created" frame) proc) | ||
| 930 | (select-frame frame) | ||
| 931 | (process-put proc 'frame frame) | ||
| 932 | (process-put proc 'terminal (frame-terminal frame)) | ||
| 933 | (process-put proc 'no-delete-terminal t) | ||
| 934 | frame)) | ||
| 935 | |||
| 921 | (defun server-goto-toplevel (proc) | 936 | (defun server-goto-toplevel (proc) |
| 922 | (condition-case nil | 937 | (condition-case nil |
| 923 | ;; If we're running isearch, we must abort it to allow Emacs to | 938 | ;; If we're running isearch, we must abort it to allow Emacs to |
| @@ -1264,6 +1279,14 @@ The following commands are accepted by the client: | |||
| 1264 | terminal-frame))))) | 1279 | terminal-frame))))) |
| 1265 | (setq tty-name nil tty-type nil) | 1280 | (setq tty-name nil tty-type nil) |
| 1266 | (if display (server-select-display display))) | 1281 | (if display (server-select-display display))) |
| 1282 | ((equal tty-type "dumb") | ||
| 1283 | ;; Emacsclient is likely running inside something | ||
| 1284 | ;; like an Emacs shell buffer. We can't run an | ||
| 1285 | ;; Emacs frame in a tty like this, so instead, use | ||
| 1286 | ;; whichever terminal is currently | ||
| 1287 | ;; selected. (bug#25547) | ||
| 1288 | (server-create-dumb-terminal-frame nowait proc | ||
| 1289 | frame-parameters)) | ||
| 1267 | ((or (and (eq system-type 'windows-nt) | 1290 | ((or (and (eq system-type 'windows-nt) |
| 1268 | (daemonp) | 1291 | (daemonp) |
| 1269 | (setq display "w32")) | 1292 | (setq display "w32")) |