Full support for multiple terminal I/O (with some rough edges).
[bpt/emacs.git] / lisp / server.el
index 8e3b7e9..f2c1fc9 100644 (file)
@@ -319,6 +319,17 @@ PROC is the server process.  Format of STRING is \"PATH PATH PATH... \\n\"."
                  (server-select-display display)
                (error (process-send-string proc (nth 1 err))
                       (setq request "")))))
+          ;; Open a new frame at the client.  ARG is the name of the pseudo tty.
+          ((and (equal "-pty" arg) (string-match "\\([^ ]*\\) \\([^ ]*\\) " request))
+           (let ((pty (server-unquote-arg (match-string 1 request)))
+                 (type (server-unquote-arg (match-string 2 request))))
+             (setq request (substring request (match-end 0)))
+             (condition-case err
+                 (progn
+                   (make-terminal-frame `((tty . ,pty) (tty-type . ,type)))
+                   (process-send-string proc (concat (number-to-string (emacs-pid)) "\n")))
+               (error (process-send-string proc (nth 1 err))
+                      (setq request "")))))
           ;; ARG is a line number option.
           ((string-match "\\`\\+[0-9]+\\'" arg)
            (setq lineno (string-to-int (substring arg 1))))