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