view README.multi-tty @ 53232:22aaf1e5fbe6

Full support for multiple terminal I/O (with some rough edges). lib-src/emacsclient.c (emacs_pid): New variable. (window_change): Forward the SIGWINCH signal to the Emacs process after copying the size parameters to the proxy terminal. (copy_from_to): New parameter (sigio), kill Emacs with SIGIO if it is nonzero. (main): Set emacs_pid. lisp/server.el (server-process-filter): Send the pid of Emacs to emacsclient. src/cm.c: Added tty parameters to all functions and all Wcm macro calls. src/cm.h: Added tty parameters to all macros. Updated function prototypes. (Wcm): Moved to struct tty_output. src/dispextern.h: Updated function prototypes. src/dispnew.c: Added tty parameters to all Wcm macro calls. (do_switch_frame): Make old frame obscured, not invisible, to solve problems with other-frame. (Wcm): Moved to struct tty_output. src/keyboard.c (read_avail_input): Select the frame corresponding to the tty that was read. Slight rearrangement of tty loop. src/lisp.h (tabs_safe_p): Removed duplicate prototype. src/sysdep.c (hft_init, hft_reset): Added tty_output parameter. (discard_tty_input): Discard input from all ttys on APOLLO, too. Whatever it is. (narrow_foreground_group, widen_foreground_group): Added tty parameter (not really useful, the functions only work on the controlling tty.) (tabs_safe_p): Added tty parameter. src/term.c Added tty parameters to all Wcm macro calls. Standardised updating_frame vs. selected frame and tty_output access. (term_init): Allocate Wcm. (syms_of_term): Provide the `multi-tty' feature. src/termchar.h (struct tty_output): Added Wcm. src/xdisp.c (try_window_id): Make sure we use the tty device corresponding to the current frame. git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-8
author Karoly Lorentey <lorentey@elte.hu>
date Sat, 27 Dec 2003 01:12:57 +0000
parents 33c3c7c16e13
children fe9b37bee5f7
line wrap: on
line source

			-*- coding: utf-8; -*-
GOAL
----

The ultimate goal of this branch is to implement support for opening
multiple, different tty devices and simultaneous X and tty frames from
a single Emacs session.

WHO IS DOING IT
---------------

I'm Károly Lőrentey.  My address: lorentey@elte.hu.

Patches or suggestions are welcome!

Retrieving the latest version of the branch:

	tla register-archive lorentey@elte.hu--2004 http://lorentey.web.elte.hu/arch/2004/
	tla get lorentey@elte.hu--2004/emacs--multi-tty--0 <directory>

(I use tla 1.1.)


STATUS
------

Basic support is there; there are some rough edges, but it already
seems to be usable.  Input is read from all terminals (NOT via
MULTIKBOARD!).  At the moment, the type of the new terminals must be
the same as the initial terminal.  Emacsclient was extended to support
opening a new terminal frame.

To try it out, start up the emacs server (M-x server-start), and then
(from a shell prompt on another terminal) start emacsclient with

	emacsclient -h

You'll have two fully working frames on separate terminals.  If you
exit emacs, both terminals should be restored to their previous
states.

X, Mac, Windows and DOS support is broken at the moment.

Tested under GNU/Linux only.

NEWS
----

For the NEWS file:

** Support for multiple terminal devices has been added.  You can
   specify a terminal device (`tty' parameter) and a terminal type
   (`tty-type' parameter) to `make-terminal-frame'. `tty' must be a
   terminal device created by the new emacsclient, or there will be
   problems with terminal input and window resizes.  (The kernel
   notifies processes about pending input or terminal resizes only on
   the controlling terminal, so we need emacsclient to sit on the real
   terminal device, create SIGIO signals upon terminal input, and
   forward SIGWINCH signals to us.)

   You can test for the presence of multiple terminal support by
   testing for the `multi-tty' feature.

** A make-frame-on-tty function has been added to make it easier to
   create frames on new terminals.

** Emacsclient has been extended to support opening a new terminal
   frame.

CHANGELOG
---------

See arch logs.


DIARY OF CHANGES
----------------

(ex-TODO items with explanations.)

-- Introduce a new abstraction for terminal devices.  

   (Done, see struct tty_output.  The abstraction is not yet
   complete.)


-- Change the bootstrap procedure to initialize tty_list.

   (Done, but needs review.)


-- Change make-terminal-frame to support specifying another tty.

   (Done, new frame parameters: `tty' and `tty-type'.)


-- Implement support for reading from multiple terminals.

   (Done, read_avail_input tries to read from each terminal, until one
   succeeds.  MULTIKBOARD is not used.  Secondary terminals don't send
   SIGIO!)

-- other-frame should cycle through the frames on the `current'
   terminal only.  

   (Done, by trivially modifiying next_frame and prev_frame.)

-- Support different terminal sizes.
   
   (Done, no problem.)

-- Make sure terminal resizes are handled gracefully.  (Could be
   problematic.)

   (Done.  We don't get automatic SIGWINCH for additional ttys,
   though.)

-- Extend emacsclient to automatically open a new tty when it connects
   to Emacs.
   
   (Done.  It's an ugly hack, needs more work.)

-- Redisplay must refresh the topmost frame on all terminals, not just
   the initial terminal.
   
   (Done, but introduced ugly redisplay problems.  Ugh.)

-- Fix redisplay problems.

   (Done, it turned out that the entire Wcm structure must be moved
   inside tty_output.  Why was it so hard for me to find this out?)

-- Provide a way for emacsclient to tell Emacs that the tty has been
   resized.

   (Done, simply forward the SIGWINCH signal.)

-- Each keypress should automatically select the frame corresponding
   to the terminal that it was coming from.  This means that Emacs
   must know from which terminal the last keyboard event came from.
   (Multikeyboard support may help with this.)

   (Done, it was quite simple.)

-- Fix SIGIO issue with secondary terminals.

   (Done, emacsclient signals Emacs after writing to the proxy pseudo
   terminal.  This means that multi-tty does not work with raw ttys!)

THINGS TO DO
------------

** Implement sane error handling after initialization.  (Currently
   emacs exits if you specify a bad terminal type.)  The helpful error
   messages must still be provided when Emacs starts.

** C-g should work on secondary terminals.

** Make make-terminal-frame look up the tty and tty-type parameters
   from the currently selected terminal before the global default.

** Move optimalization parameters (costs) from union output_data to
   a backend-neutral per-device structure.

** Implement terminal deletion, i.e., deleting local frames, closing
   the tty device and restoring its previous state without exiting
   Emacs.  This should be exported to the Lisp environment.

** Implement automatic deletion of terminals when the last frame on
   that terminal is closed.

** Put all cached terminal escape sequences into struct tty_output.
   Currently, they are still stored in global variables, so we don't
   really support multiple terminal types.

** Make parts of struct tty_output accessible from Lisp.  The device
   name and the type is sufficient.

** Implement support for starting an interactive Emacs session without
   an initial frame.  (The user would connect to it and open frames
   later, with emacsclient.)  Not necessary a good idea.

** Support raw secondary terminals.  (This one is tricky, SIGIO works
   only on the controlling terminal.)

** What does interrupt_input do?  I tried to disable it for raw
   secondary tty support, but it seems not to do anything useful.

** Fix X support.

** Do tty output through term_hooks, too.

** Allow simultaneous X and tty frames.

** Fix Mac support (I can't do this myself).

** Fix W32 support (I can't do this myself).

** Fix DOS support (I can't do this myself).



;;; arch-tag: 8da1619e-2e79-41a8-9ac9-a0485daad17d