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