README.multi-tty updates.
[emacs.git] / README.multi-tty
blob365810d1baeda6423b36ab2c5192ea1f8e192cef
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 with C-x 5 0, i.e., delete-frame.
50 X, Mac, Windows and DOS support is broken, probably doesn't even
51 compile -- this will be solved later.
53 Tested under GNU/Linux only.
55 NEWS
56 ----
58 For the NEWS file:
60 ** Support for multiple terminal devices has been added.  You can
61    specify a terminal device (`tty' parameter) and a terminal type
62    (`tty-type' parameter) to `make-terminal-frame'. `tty' must be a
63    terminal device created by the updated emacsclient, or there will
64    be problems with terminal input and window resizes.  (The kernel
65    notifies processes about pending input or terminal resizes only on
66    the controlling terminal, so we need emacsclient to sit on the real
67    terminal device, create SIGIO signals upon terminal input, and
68    forward SIGWINCH signals to us.)
70    You can test for the presence of multiple terminal support by
71    testing for the `multi-tty' feature.
73 ** A make-frame-on-tty function has been added to make it easier to
74    create frames on new terminals.
76 ** Emacsclient has been extended to support opening a new terminal
77    frame.
79 CHANGELOG
80 ---------
82 See arch logs.
85 DIARY OF CHANGES
86 ----------------
88 (ex-TODO items with explanations.)
90 -- Introduce a new abstraction for terminal devices.  
92    (Done, see struct tty_output.  The abstraction is not yet
93    complete.)
95 -- Change the bootstrap procedure to initialize tty_list.
97    (Done, but needs review.)
99 -- Change make-terminal-frame to support specifying another tty.
101    (Done, new frame parameters: `tty' and `tty-type'.)
103 -- Implement support for reading from multiple terminals.
105    (Done, read_avail_input tries to read from each terminal, until one
106    succeeds.  MULTIKBOARD is not used.  Secondary terminals don't send
107    SIGIO!)
109 -- other-frame should cycle through the frames on the `current'
110    terminal only.  
112    (Done, by trivially modifiying next_frame and prev_frame.)
114 -- Support different terminal sizes.
115    
116    (Done, no problem.)
118 -- Make sure terminal resizes are handled gracefully.  (Could be
119    problematic.)
121    (Done.  We don't get automatic SIGWINCH for additional ttys,
122    though.)
124 -- Extend emacsclient to automatically open a new tty when it connects
125    to Emacs.
126    
127    (Done.  It's an ugly hack, needs more work.)
129 -- Redisplay must refresh the topmost frame on *all* terminals, not
130    just the initial terminal.
131    
132    (Done, but introduced an ugly redisplay problems.  Ugh.)
134 -- Fix redisplay problems.
136    (Done; it turned out that the entire Wcm structure must be moved
137    inside tty_output.  Why didn't I catch this earlier?)
139 -- Provide a way for emacsclient to tell Emacs that the tty has been
140    resized.
142    (Done, simply forward the SIGWINCH signal.)
144 -- Each keypress should automatically select the frame corresponding
145    to the terminal that it was coming from.  This means that Emacs
146    must know from which terminal the last keyboard event came from.
148    (Done, it was quite simple, the input event system already
149    supported multiple frames.)
151 -- Fix SIGIO issue with secondary terminals.
153    (Done, emacsclient signals Emacs after writing to the proxy pseudo
154    terminal.  Note that this means that multi-tty does not work with
155    raw ttys!)
157 -- Make make-terminal-frame look up the `tty' and `tty-type' frame
158    parameters from the currently selected terminal before the global
159    default.
161    (Done.)
163 -- Put all cached terminal escape sequences into struct tty_output.
164    Currently, they are still stored in global variables, so we don't
165    really support multiple terminal types.
167    (Done.  It was not fun.)
169 -- Implement sane error handling after initialization.  (Currently
170    emacs exits if you specify a bad terminal type.)  The helpful error
171    messages must still be provided when Emacs starts.
173    (Done.)
175 -- Implement terminal deletion, i.e., deleting local frames, closing
176    the tty device and restoring its previous state without exiting
177    Emacs.
179    (Done, but at the moment only called when an error happens during
180    initialization.  There is a memory corruption error around this
181    somewhere.)
183 -- Implement automatic deletion of terminals when the last frame on
184    that terminal is closed.
186    (Done.)
189 THINGS TO DO
190 ------------
192 ** Fix mysterious memory corruption error with tty deletion.  To
193    trigger it, try the following shell command:
195         while true; do TERM=no-such-terminal-definition emacsclient -h; done
197    Emacs usually dumps core after a few dozen iterations.  (The bug
198    seems to be related to the xfree()ing or bzero()ing of
199    tty_output.Wcm or some other tty_output part.  Maybe there are
200    outside references to struct Wcm?  Why were these vars collected
201    into a struct before multi-tty support?)
203    The bug does not seem to happen if the error occurs before terminal
204    initialization or if I comment out all xfree()s in delete_frame.
205    Update: yes it does, although it is much rarer.  Or maybe it's
206    another bug.
208 ** Change emacsclient/server.el to support the -h argument better,
209    i.e. automatically close the socket when the frame is closed.
211 ** Export delete_tty to the Lisp environment, for emacsclient.
213 ** Restore tty screen after closing the terminal.
215 ** 'TERM=dumb src/emacs' does not restore the terminal state.
217 ** C-g should work on secondary terminals.
219 ** Make parts of struct tty_output accessible from Lisp.  The device
220    name and the type is sufficient.
222 ** Find out why does Emacs abort when it wants to close its
223    controlling tty.
225 ** Implement support for starting an interactive Emacs session without
226    an initial frame.  (The user would connect to it and open frames
227    later, with emacsclient.)  Not necessarily a good idea.
229 ** Support raw secondary terminals.  (This one is tricky, SIGIO works
230    only on the controlling terminal.  The emacsclient solution works
231    nicely, so this is not that important anyway.)
233 ** What does interrupt_input do?  I tried to disable it for raw
234    secondary tty support, but it does not seem to do anything useful.
236 ** Move optimalization parameters (costs) from union output_data to
237    a backend-neutral per-device structure.
239 ** Find out the best way to support suspending Emacs with multiple
240    ttys.
242 ** Do tty output through term_hooks, like all other display backends.
244 ** Fix X support.
246 ** Allow simultaneous X and tty frames.
248 ** Fix Mac support (I can't do this myself).
250 ** Fix W32 support (I can't do this myself).
252 ** Fix DOS support (I can't do this myself).
256 ;;; arch-tag: 8da1619e-2e79-41a8-9ac9-a0485daad17d