Merged in changes from CVS HEAD
[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
bc279d67
KL
31To try it out, compile Emacs with the following commands
32
33 mkdir +build
34 cd +build
35 ../configure --with-x-toolkit=no --without-x
36 make bootstrap
37
38then start up the emacs server (src/emacs, M-x server-start), and then
6548cf00 39(from a shell prompt on another terminal) start emacsclient with
28d440ab 40
bc279d67 41 lib-src/emacsclient -h
28d440ab 42
52c2ee2a
KL
43You'll hopefully have two fully working frames on separate terminals.
44If you exit emacs, both terminals should be restored to their previous
c33d2d42 45states. You can close the newly opened frame and return to the shell
53fed860 46without exiting Emacs by pressing C-x 5 0, i.e., delete-frame.
52c2ee2a
KL
47
48X, Mac, Windows and DOS support is broken, probably doesn't even
49compile -- this will be solved later.
6548cf00
KL
50
51Tested under GNU/Linux only.
28d440ab
KL
52
53NEWS
54----
55
56For the NEWS file:
57
58** Support for multiple terminal devices has been added. You can
59 specify a terminal device (`tty' parameter) and a terminal type
6548cf00 60 (`tty-type' parameter) to `make-terminal-frame'. `tty' must be a
52c2ee2a
KL
61 terminal device created by the updated emacsclient, or there will
62 be problems with terminal input and window resizes. (The kernel
6548cf00
KL
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.)
67
68 You can test for the presence of multiple terminal support by
69 testing for the `multi-tty' feature.
70
71** A make-frame-on-tty function has been added to make it easier to
72 create frames on new terminals.
28d440ab 73
9628b887
KL
74** Emacsclient has been extended to support opening a new terminal
75 frame.
28d440ab
KL
76
77CHANGELOG
78---------
79
80See arch logs.
81
82
6548cf00
KL
83DIARY OF CHANGES
84----------------
85
86(ex-TODO items with explanations.)
28d440ab
KL
87
88-- Introduce a new abstraction for terminal devices.
89
90 (Done, see struct tty_output. The abstraction is not yet
91 complete.)
92
28d440ab
KL
93-- Change the bootstrap procedure to initialize tty_list.
94
95 (Done, but needs review.)
96
28d440ab
KL
97-- Change make-terminal-frame to support specifying another tty.
98
99 (Done, new frame parameters: `tty' and `tty-type'.)
100
9628b887
KL
101-- Implement support for reading from multiple terminals.
102
103 (Done, read_avail_input tries to read from each terminal, until one
6548cf00
KL
104 succeeds. MULTIKBOARD is not used. Secondary terminals don't send
105 SIGIO!)
9628b887
KL
106
107-- other-frame should cycle through the frames on the `current'
6548cf00 108 terminal only.
9628b887 109
6548cf00 110 (Done, by trivially modifiying next_frame and prev_frame.)
9628b887
KL
111
112-- Support different terminal sizes.
113
114 (Done, no problem.)
115
116-- Make sure terminal resizes are handled gracefully. (Could be
117 problematic.)
118
6548cf00
KL
119 (Done. We don't get automatic SIGWINCH for additional ttys,
120 though.)
9628b887
KL
121
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.)
126
52c2ee2a
KL
127-- Redisplay must refresh the topmost frame on *all* terminals, not
128 just the initial terminal.
9628b887 129
52c2ee2a 130 (Done, but introduced an ugly redisplay problems. Ugh.)
9628b887 131
6548cf00
KL
132-- Fix redisplay problems.
133
52c2ee2a
KL
134 (Done; it turned out that the entire Wcm structure must be moved
135 inside tty_output. Why didn't I catch this earlier?)
6548cf00
KL
136
137-- Provide a way for emacsclient to tell Emacs that the tty has been
138 resized.
139
140 (Done, simply forward the SIGWINCH signal.)
141
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.
6548cf00 145
52c2ee2a
KL
146 (Done, it was quite simple, the input event system already
147 supported multiple frames.)
6548cf00
KL
148
149-- Fix SIGIO issue with secondary terminals.
150
151 (Done, emacsclient signals Emacs after writing to the proxy pseudo
52c2ee2a
KL
152 terminal. Note that this means that multi-tty does not work with
153 raw ttys!)
28d440ab 154
fca177d4
KL
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.
158
159 (Done.)
160
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.
164
52c2ee2a 165 (Done. It was not fun.)
fca177d4
KL
166
167-- Implement sane error handling after initialization. (Currently
6548cf00
KL
168 emacs exits if you specify a bad terminal type.) The helpful error
169 messages must still be provided when Emacs starts.
170
fca177d4
KL
171 (Done.)
172
173-- Implement terminal deletion, i.e., deleting local frames, closing
174 the tty device and restoring its previous state without exiting
175 Emacs.
9628b887 176
fca177d4
KL
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.)
180
8303ba32
KL
181-- Implement automatic deletion of terminals when the last frame on
182 that terminal is closed.
183
184 (Done.)
185
fca177d4
KL
186
187THINGS TO DO
188------------
189
190** Fix mysterious memory corruption error with tty deletion. To
191 trigger it, try the following shell command:
192
193 while true; do TERM=no-such-terminal-definition emacsclient -h; done
194
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
52c2ee2a
KL
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?)
fca177d4 200
52c2ee2a 201 The bug does not seem to happen if the error occurs before terminal
fca177d4 202 initialization or if I comment out all xfree()s in delete_frame.
52c2ee2a
KL
203 Update: yes it does, although it is much rarer. Or maybe it's
204 another bug.
fca177d4 205
8303ba32
KL
206** Change emacsclient/server.el to support the -h argument better,
207 i.e. automatically close the socket when the frame is closed.
28d440ab 208
8303ba32
KL
209** Export delete_tty to the Lisp environment, for emacsclient.
210
c33d2d42
KL
211** Restore tty screen after closing the terminal.
212
213** 'TERM=dumb src/emacs' does not restore the terminal state.
214
8303ba32 215** C-g should work on secondary terminals.
28d440ab 216
6548cf00
KL
217** Make parts of struct tty_output accessible from Lisp. The device
218 name and the type is sufficient.
28d440ab 219
c33d2d42
KL
220** Find out why does Emacs abort when it wants to close its
221 controlling tty.
222
28d440ab
KL
223** Implement support for starting an interactive Emacs session without
224 an initial frame. (The user would connect to it and open frames
fca177d4 225 later, with emacsclient.) Not necessarily a good idea.
28d440ab 226
6548cf00 227** Support raw secondary terminals. (This one is tricky, SIGIO works
52c2ee2a
KL
228 only on the controlling terminal. The emacsclient solution works
229 nicely, so this is not that important anyway.)
6548cf00
KL
230
231** What does interrupt_input do? I tried to disable it for raw
52c2ee2a 232 secondary tty support, but it does not seem to do anything useful.
6548cf00 233
52c2ee2a
KL
234** Move optimalization parameters (costs) from union output_data to
235 a backend-neutral per-device structure.
28d440ab 236
c33d2d42
KL
237** Find out the best way to support suspending Emacs with multiple
238 ttys.
239
240** Do tty output through term_hooks, like all other display backends.
6548cf00 241
52c2ee2a
KL
242** Fix X support.
243
28d440ab
KL
244** Allow simultaneous X and tty frames.
245
246** Fix Mac support (I can't do this myself).
247
248** Fix W32 support (I can't do this myself).
249
250** Fix DOS support (I can't do this myself).
251
252
253
254;;; arch-tag: 8da1619e-2e79-41a8-9ac9-a0485daad17d