Merged in changes from CVS HEAD
[emacs.git] / README.multi-tty
bloba4bbb52f62f80f42eb52e0b067b9e7bf8ed98da9
1                         -*- coding: utf-8; -*-
2 GOAL
3 ----
5 The ultimate goal of this branch is to implement support for opening
6 multiple, different tty devices and simultaneous X and tty frames from
7 a single Emacs session.
9 WHO IS DOING IT
10 ---------------
12 I'm Károly Lőrentey.  My address: lorentey@elte.hu.
14 Patches or suggestions are welcome!
16 Retrieving the latest version of the branch:
18         tla register-archive lorentey@elte.hu--2004 http://lorentey.web.elte.hu/arch/2004/
19         tla get lorentey@elte.hu--2004/emacs--multi-tty--0 <directory>
21 (I use tla 1.1.)
24 STATUS
25 ------
27 Basic multi-tty support is there; there are some rough edges, but it
28 already seems to be usable.  Emacsclient has been extended to support
29 opening a new terminal frame.
31 To try it out, compile Emacs with the following commands
33         mkdir +build
34         cd +build
35         ../configure --with-x-toolkit=no --without-x
36         make bootstrap
38 then start up the emacs server (src/emacs, M-x server-start), and then
39 (from a shell prompt on another terminal) start emacsclient with
41         lib-src/emacsclient -h
43 You'll hopefully have two fully working frames on separate terminals.
44 If you exit emacs, both terminals should be restored to their previous
45 states.  You can close the newly opened frame and return to the shell
46 without exiting Emacs by pressing C-x 5 0, i.e., delete-frame.
48 X, Mac, Windows and DOS support is broken, probably doesn't even
49 compile -- this will be solved later.
51 Tested under GNU/Linux only.
53 NEWS
54 ----
56 For the NEWS file:
58 ** Support for multiple terminal devices has been added.  You can
59    specify a terminal device (`tty' parameter) and a terminal type
60    (`tty-type' parameter) to `make-terminal-frame'. `tty' must be a
61    terminal device created by the updated emacsclient, or there will
62    be problems with terminal input and window resizes.  (The kernel
63    notifies processes about pending input or terminal resizes only on
64    the controlling terminal, so we need emacsclient to sit on the real
65    terminal device, create SIGIO signals upon terminal input, and
66    forward SIGWINCH signals to us.)
68    You can test for the presence of multiple terminal support by
69    testing for the `multi-tty' feature.
71 ** A make-frame-on-tty function has been added to make it easier to
72    create frames on new terminals.
74 ** Emacsclient has been extended to support opening a new terminal
75    frame.
77 CHANGELOG
78 ---------
80 See arch logs.
83 DIARY OF CHANGES
84 ----------------
86 (ex-TODO items with explanations.)
88 -- Introduce a new abstraction for terminal devices.  
90    (Done, see struct tty_output.  The abstraction is not yet
91    complete.)
93 -- Change the bootstrap procedure to initialize tty_list.
95    (Done, but needs review.)
97 -- Change make-terminal-frame to support specifying another tty.
99    (Done, new frame parameters: `tty' and `tty-type'.)
101 -- Implement support for reading from multiple terminals.
103    (Done, read_avail_input tries to read from each terminal, until one
104    succeeds.  MULTIKBOARD is not used.  Secondary terminals don't send
105    SIGIO!)
107 -- other-frame should cycle through the frames on the `current'
108    terminal only.  
110    (Done, by trivially modifiying next_frame and prev_frame.)
112 -- Support different terminal sizes.
113    
114    (Done, no problem.)
116 -- Make sure terminal resizes are handled gracefully.  (Could be
117    problematic.)
119    (Done.  We don't get automatic SIGWINCH for additional ttys,
120    though.)
122 -- Extend emacsclient to automatically open a new tty when it connects
123    to Emacs.
124    
125    (Done.  It's an ugly hack, needs more work.)
127 -- Redisplay must refresh the topmost frame on *all* terminals, not
128    just the initial terminal.
129    
130    (Done, but introduced an ugly redisplay problems.  Ugh.)
132 -- Fix redisplay problems.
134    (Done; it turned out that the entire Wcm structure must be moved
135    inside tty_output.  Why didn't I catch this earlier?)
137 -- Provide a way for emacsclient to tell Emacs that the tty has been
138    resized.
140    (Done, simply forward the SIGWINCH signal.)
142 -- Each keypress should automatically select the frame corresponding
143    to the terminal that it was coming from.  This means that Emacs
144    must know from which terminal the last keyboard event came from.
146    (Done, it was quite simple, the input event system already
147    supported multiple frames.)
149 -- Fix SIGIO issue with secondary terminals.
151    (Done, emacsclient signals Emacs after writing to the proxy pseudo
152    terminal.  Note that this means that multi-tty does not work with
153    raw ttys!)
155 -- Make make-terminal-frame look up the `tty' and `tty-type' frame
156    parameters from the currently selected terminal before the global
157    default.
159    (Done.)
161 -- Put all cached terminal escape sequences into struct tty_output.
162    Currently, they are still stored in global variables, so we don't
163    really support multiple terminal types.
165    (Done.  It was not fun.)
167 -- Implement sane error handling after initialization.  (Currently
168    emacs exits if you specify a bad terminal type.)  The helpful error
169    messages must still be provided when Emacs starts.
171    (Done.)
173 -- Implement terminal deletion, i.e., deleting local frames, closing
174    the tty device and restoring its previous state without exiting
175    Emacs.
177    (Done, but at the moment only called when an error happens during
178    initialization.  There is a memory corruption error around this
179    somewhere.)
181 -- Implement automatic deletion of terminals when the last frame on
182    that terminal is closed.
184    (Done.)
187 THINGS TO DO
188 ------------
190 ** Fix mysterious memory corruption error with tty deletion.  To
191    trigger it, try the following shell command:
193         while true; do TERM=no-such-terminal-definition emacsclient -h; done
195    Emacs usually dumps core after a few dozen iterations.  (The bug
196    seems to be related to the xfree()ing or bzero()ing of
197    tty_output.Wcm or some other tty_output part.  Maybe there are
198    outside references to struct Wcm?  Why were these vars collected
199    into a struct before multi-tty support?)
201    The bug does not seem to happen if the error occurs before terminal
202    initialization or if I comment out all xfree()s in delete_frame.
203    Update: yes it does, although it is much rarer.  Or maybe it's
204    another bug.
206 ** Change emacsclient/server.el to support the -h argument better,
207    i.e. automatically close the socket when the frame is closed.
209 ** Export delete_tty to the Lisp environment, for emacsclient.
211 ** Restore tty screen after closing the terminal.
213 ** 'TERM=dumb src/emacs' does not restore the terminal state.
215 ** C-g should work on secondary terminals.
217 ** Make parts of struct tty_output accessible from Lisp.  The device
218    name and the type is sufficient.
220 ** Find out why does Emacs abort when it wants to close its
221    controlling tty.
223 ** Implement support for starting an interactive Emacs session without
224    an initial frame.  (The user would connect to it and open frames
225    later, with emacsclient.)  Not necessarily a good idea.
227 ** Support raw secondary terminals.  (This one is tricky, SIGIO works
228    only on the controlling terminal.  The emacsclient solution works
229    nicely, so this is not that important anyway.)
231 ** What does interrupt_input do?  I tried to disable it for raw
232    secondary tty support, but it does not seem to do anything useful.
234 ** Move optimalization parameters (costs) from union output_data to
235    a backend-neutral per-device structure.
237 ** Find out the best way to support suspending Emacs with multiple
238    ttys.
240 ** Do tty output through term_hooks, like all other display backends.
242 ** Fix X support.
244 ** Allow simultaneous X and tty frames.
246 ** Fix Mac support (I can't do this myself).
248 ** Fix W32 support (I can't do this myself).
250 ** Fix DOS support (I can't do this myself).
254 ;;; arch-tag: 8da1619e-2e79-41a8-9ac9-a0485daad17d