Commit | Line | Data |
---|---|---|
3224dac1 | 1 | -*- coding: utf-8; mode: text; -*- |
28d440ab KL |
2 | GOAL |
3 | ---- | |
4 | ||
2246281f KL |
5 | The goal of this branch is to implement support for opening multiple, |
6 | different tty devices and simultaneous X and tty frames from a single | |
7 | Emacs session. | |
28d440ab | 8 | |
7b00d185 | 9 | Some use cases: |
7b00d185 KL |
10 | Emacs is notoriously slow at startup, so most people use another |
11 | editor or emacsclient for quick editing jobs from the console. | |
12 | Unfortunately, emacsclient was very awkward to use, because it did not | |
13 | support opening a new Emacs frame on the current virtual console. | |
14 | Now, with multi-tty support, it can do that. (Emacsclient starts up | |
15 | faster than vi!) | |
16 | ||
17 | Some Gnus users (including me) run Gnus in an X frame in its own Emacs | |
18 | instance, which they typically leave running for weeks. It would be | |
19 | nice if they could connect to this instance from a remote ssh session | |
20 | and check their messages without opening a remote X frame or resorting | |
21 | to gnus-slave. | |
22 | ||
28d440ab KL |
23 | WHO IS DOING IT |
24 | --------------- | |
25 | ||
26 | I'm Károly Lőrentey. My address: lorentey@elte.hu. | |
27 | ||
2246281f | 28 | Comments, bug reports, suggestions and patches are welcome! |
28d440ab | 29 | |
6548cf00 | 30 | Retrieving the latest version of the branch: |
4f0359de KL |
31 | |
32 | tla register-archive lorentey@elte.hu--2004 http://lorentey.web.elte.hu/arch/2004/ | |
daf01701 | 33 | tla get lorentey@elte.hu--2004/emacs--multi-tty <directory> |
4f0359de | 34 | |
7b00d185 KL |
35 | (I use a recent arch development snapshot, but any of the released |
36 | versions of arch will do fine, I think.) | |
37 | ||
6ad9aaa9 KL |
38 | To update your source tree to the latest revision after the first |
39 | checkout, simply use the following command: | |
40 | ||
41 | tla replay lorentey@elte.hu--2004/emacs--multi-tty--0 | |
42 | ||
43 | If you are interested, you can find more detailed information about | |
44 | Arch on http://wiki.gnuarch.org/. It's a wonderful source control | |
45 | system, I highly recommend it. | |
46 | ||
7b00d185 KL |
47 | If you don't have arch, the branch has a homepage from which you can |
48 | download conventional patches against Emacs CVS HEAD: | |
4f0359de | 49 | |
7b00d185 | 50 | http://lorentey.web.elte.hu/project/emacs.html |
28d440ab | 51 | |
6c3d443b KL |
52 | If you want to be notified of new revisions, sign up to the |
53 | multi-tty@listbox.elte.hu mailing list by visiting the | |
54 | below homepage and following its instructions. | |
55 | ||
56 | https://listbox.elte.hu/mailman/listinfo/multi-tty | |
57 | ||
58 | Please note that the multi-tty mailing list is read-only, and is | |
59 | reserved for automatic commit messages. Discussion about the branch | |
60 | and bug reports should be sent directly to me (lorentey@elte.hu), or | |
aaaf7fe1 KL |
61 | to the emacs-devel@gnu.org mailing list. (I hope to merge my branch |
62 | into CVS HEAD reasonably soon, so I don't want to set up an elaborate | |
63 | development infrastructure for the multi-tty branch.) | |
6c3d443b | 64 | |
28d440ab KL |
65 | STATUS |
66 | ------ | |
67 | ||
2cd1371d KL |
68 | The branch is now very stable and almost full-featured. All of the |
69 | major problems have been fixed, only a few minor issues remain. (It | |
70 | still needs to be ported to Windows/Mac/DOS, though.) Both multiple | |
71 | tty device support and simultaneous X and tty frame support works | |
72 | fine. Emacsclient has been extended to support opening new tty and X | |
73 | frames. It has been changed open new Emacs frames by default. | |
74 | ||
75 | The multi-tty branch has been scheduled for inclusion in the next | |
76 | major release of Emacs (version 22). I expect the merge into the | |
77 | development trunk to occur sometime during next year (2005), after the | |
78 | merge of the Unicode branch. | |
2246281f | 79 | |
2246281f | 80 | Please let me know if you find any bugs in this branch. |
28d440ab | 81 | |
0c72d684 KL |
82 | HOW TO COMPILE AND TEST |
83 | ----------------------- | |
84 | ||
aaaf7fe1 KL |
85 | To try out the multi-tty branch, compile and run the multi-tty branch |
86 | with the following commands: | |
bc279d67 | 87 | |
2a0c7b06 | 88 | find -name "*.elc" | xargs rm # Delete leftover stuff |
bc279d67 KL |
89 | mkdir +build |
90 | cd +build | |
0c72d684 | 91 | ../configure <your favourite options> |
bc279d67 | 92 | make bootstrap |
2246281f | 93 | src/emacs -nw # You can also try without -nw |
7b00d185 | 94 | M-x server-start |
bc279d67 | 95 | |
7b00d185 KL |
96 | and then (from a shell prompt on another terminal) start emacsclient |
97 | with | |
aaaf7fe1 KL |
98 | lib-src/emacsclient /optional/file/names... |
99 | or | |
7b00d185 | 100 | lib-src/emacsclient -t /optional/file/names... |
28d440ab | 101 | |
04c3243c | 102 | You'll hopefully have two fully working, independent frames on |
7b00d185 | 103 | separate terminals. The new frame is closed automatically when you |
2a0c7b06 KL |
104 | finish editing the specified files (C-x #), but delete-frame (C-x 5 0) |
105 | also works. Of course, you can create frames on more than two tty | |
106 | devices. | |
52c2ee2a | 107 | |
7b00d185 KL |
108 | Creating new frames on the same tty with C-x 5 2 works, and they |
109 | behave the same way as in previous Emacs versions. If you exit emacs, | |
110 | all terminals should be restored to their previous states. | |
daf01701 | 111 | |
7b00d185 KL |
112 | This is work in progress, and probably full of bugs. You should |
113 | always run emacs from gdb, so that you'll have a live instance to | |
2246281f | 114 | debug if something goes wrong. Please send me your bug reports. |
04c3243c | 115 | |
bacb6689 KL |
116 | I think the best way to use the new Emacs is to have it running inside |
117 | a disconnected GNU screen session, and always use emacsclient for | |
118 | normal work. This way not a single keystroke of your work will be | |
119 | lost if the display device that you are using crashes, or the network | |
120 | connection times out, or whatever. As long as the server that runs | |
121 | your Emacs remains up, all your buffers remain exactly as they were | |
122 | before the crash, and you can continue working as if nothing had | |
123 | happened. (I had an extremely unstable X server for some time while I | |
124 | was developing these patches, and running Emacs this way has saved me | |
125 | a number of M-x recover-session invocations.) | |
126 | ||
127 | (I am thinking about introducing a --daemon option to get rid of the | |
128 | above screen dependency.) | |
129 | ||
7b00d185 | 130 | Problems: |
6548cf00 | 131 | |
7b00d185 KL |
132 | * Mac, Windows and DOS support is broken, probably doesn't |
133 | even compile -- this will be solved later. | |
134 | ||
d3c554a0 | 135 | * Only tested on my GNU/Linux box, Solaris 8 and FreeBSD. |
28d440ab KL |
136 | |
137 | NEWS | |
138 | ---- | |
139 | ||
2cd1371d | 140 | For the NEWS file: (Needs work) |
28d440ab | 141 | |
2246281f | 142 | ** Support for multiple terminal devices has been added. |
6548cf00 | 143 | |
2246281f KL |
144 | *** You can specify a terminal device (`tty' parameter) and a terminal |
145 | type (`tty-type' parameter) to `make-terminal-frame'. | |
6548cf00 | 146 | |
2246281f KL |
147 | *** You can test for the presence of multiple terminal support by |
148 | testing for the `multi-tty' feature. | |
28d440ab | 149 | |
2246281f | 150 | *** Emacsclient has been extended to support opening a new terminal |
aaaf7fe1 KL |
151 | frame. Its behaviour has been changed to open a new Emacs frame by |
152 | default. Use the -c option to get the old behavior of opening | |
153 | files in the currently selected Emacs frame. | |
e5299d8d | 154 | |
2246281f KL |
155 | *** A make-frame-on-tty function has been added to make it easier to |
156 | create frames on new terminals. | |
157 | ||
158 | *** New functions: frame-tty-name, frame-tty-type for accessing | |
159 | terminal parameters, and delete-tty for closing the terminal | |
160 | device. | |
161 | ||
162 | *** talk.el has been extended for multiple tty support. | |
163 | ||
164 | ||
165 | ** Support for simultaneous graphical and terminal frames has been | |
166 | added. | |
167 | ||
168 | *** The function `make-frame-on-display' now works during a terminal | |
169 | session, and `make-frame-on-tty' works during a graphical session. | |
170 | ||
171 | *** The `window-system' variable has been made frame-local. | |
172 | ||
173 | *** The new `initial-window-system' variable contains the | |
174 | `window-system' value for the first frame. | |
819b8f00 | 175 | |
d448e982 KL |
176 | THANKS |
177 | ------ | |
178 | ||
179 | The following is an (incomplete) list of people who have contributed | |
180 | to the project by testing, bug reports, and suggestions. Thanks! | |
181 | ||
7c10362e | 182 | ARISAWA Akihiro <ari at mbf dot ocn dot ne dot jp> |
026ad6ba | 183 | Robert J. Chassell <bob at rattlesnake dot com> |
806c1866 | 184 | Romain Francoise <romain at orebokech dot com> |
0c72d684 | 185 | Ami Fischman <ami at fischman dot org> |
35dfa9b6 | 186 | Friedrich Delgado Friedrichs <friedel at nomaden dot org> |
1eceabe3 | 187 | IRIE Tetsuya <irie at t dot email dot ne dot jp> |
3de8a253 | 188 | Yoshiaki Kasahara <kasahara at nc dot kyushu-u dot ac dot jp> |
8c8d5f35 | 189 | Jurej Kubelka <Juraj dot Kubelka at email dot cz> |
4edd8a5c | 190 | Istvan Marko <mi-mtty ar kismala dot com> |
0c72d684 | 191 | Dan Nicolaescu <dann at ics dot uci dot edu> |
cd5355f9 | 192 | Gergely Nagy <algernon at debian dot org> |
aaaf7fe1 | 193 | Mark Plaksin <happy at mcplaksin dot org> |
026ad6ba | 194 | Francisco Borges <borges at let dot rug dot nl> |
d3c554a0 | 195 | Frank Ruell <stoerte at dreamwarrior dot net> |
f76e7db6 | 196 | Dan Waber <dwaber at logolalia dot com> |
9002956f | 197 | and many others. |
0c72d684 | 198 | |
d3c554a0 KL |
199 | Richard Stallman was kind enough to review an earlier version of my |
200 | patches. | |
d448e982 | 201 | |
28d440ab KL |
202 | CHANGELOG |
203 | --------- | |
204 | ||
205 | See arch logs. | |
206 | ||
7b00d185 KL |
207 | THINGS TO DO |
208 | ------------ | |
4edd8a5c | 209 | |
b6660415 KL |
210 | ** Hunt down display-related functions in frame.el and extend them all |
211 | to accept display ids. | |
212 | ||
6ea444cf KL |
213 | ** Have a look at fatal_error_hook. |
214 | ||
7d1a6b33 KL |
215 | ** Check if we got term-setup-hook right. |
216 | ||
54021676 KL |
217 | ** make-frame does not correctly handle extra parameters in its |
218 | argument: | |
219 | ||
220 | (frame-parameter (make-frame (list (cons 'foobar 42))) 'foobar) | |
221 | => nil | |
222 | ||
223 | (This is likely an error in the CVS trunk.) | |
224 | ||
d3c554a0 KL |
225 | ** Fix set-input-mode for multi-tty. It's a truly horrible interface; |
226 | what if we'd blow it up into several separate functions (with a | |
227 | compatibility definition)? | |
228 | ||
f76e7db6 KL |
229 | ** Lisp-level stuff that needs to be updated for multi-tty: |
230 | ||
231 | - normal-erase-is-backspace-mode (simple.el) (rep. by Dan Waber) | |
232 | ||
233 | ||
cd5355f9 KL |
234 | ** The single-keyboard mode of MULTI_KBOARD is extremely confusing |
235 | sometimes; Emacs does not respond to stimuli from other keyboards. | |
236 | At least a beep or a message would be important, if the single-mode | |
237 | is still required to prevent interference. (Reported by Dan | |
026ad6ba KL |
238 | Nicolaescu.) (Update: selecting a region with the mouse enables |
239 | single_kboard under X. This is very confusing.) | |
cd5355f9 | 240 | |
2666355c KL |
241 | ** The terminal customization files in term/*.el tend to change global |
242 | parameters, which may confuse Emacs with multiple displays. Change | |
243 | them to tweak only frame-local settings, if possible. | |
244 | ||
01d81f75 KL |
245 | ** Dan Nicolaescu suggests that -nw should be added as an alias for -t |
246 | in emacsclient. Good idea. (Alas, implementing this is not | |
247 | trivial, getopt_long does not seem to support two-letter ``short'' | |
d3c554a0 | 248 | options. Patches are welcome.) :-) |
01d81f75 KL |
249 | |
250 | ** Mark Plaksin suggests that emacsclient should accept the same | |
251 | X-related command-line arguments as Emacs. Most of the X-related | |
252 | argument-handling is done in Lisp, so this should be quite easy to | |
253 | implement. | |
d448e982 | 254 | |
cd5355f9 KL |
255 | ** Gergely Nagy suggests that C-x # should only kill the current |
256 | frame, not any other emacsclient frame that may have the same file | |
257 | opened for editing. I think I agree with him. | |
258 | ||
d3c554a0 KL |
259 | ** Miles Bader suggests that C-x C-c on an emacsclient frame should |
260 | only close the frame, not exit the entire Emacs session. | |
261 | ||
0b0d3e0b KL |
262 | ** Very strange bug: visible-bell does not work on secondary |
263 | terminals in xterm and konsole. The screen does flicker a bit, | |
264 | but it's so quick it isn't noticable. | |
265 | ||
266 | ** Clean up the frame-local variable system. I think it's ugly and | |
267 | error-prone. But maybe I just haven't yet fully understood it. | |
268 | ||
428a555e | 269 | ** Move baud_rate to struct display. |
7b00d185 | 270 | |
7b00d185 KL |
271 | ** Implement support for starting an interactive Emacs session without |
272 | an initial frame. (The user would connect to it and open frames | |
f70dd009 | 273 | later, with emacsclient.) |
7b00d185 | 274 | |
2cd1371d KL |
275 | ** Fix Mac support (I can't do this entirely myself). Note that the |
276 | current state of Mac-specific source files in the multi-tty tree | |
277 | are not useful; before starting work on Mac support, revert to | |
278 | pristine, pre-multi-tty versions. | |
7b00d185 | 279 | |
2cd1371d KL |
280 | ** Fix W32 support (I can't do this entirely myself). Note that the |
281 | current state of W32-specific source files in the multi-tty tree | |
282 | are not useful; before starting work on W32 support, revert to | |
283 | pristine, pre-multi-tty versions. | |
7b00d185 | 284 | |
2cd1371d KL |
285 | ** Fix DOS support (I can't do this entirely myself). Note that the |
286 | current state of DOS-specific source files in the multi-tty tree | |
287 | are not useful; before starting work on DOS support, revert to | |
288 | pristine, pre-multi-tty versions. | |
7b00d185 KL |
289 | |
290 | ** Do a grep on XXX and ?? for more issues. | |
291 | ||
d3c554a0 KL |
292 | ** Understand Emacs's low-level input system (it's black magic) :-) |
293 | What exactly does interrupt_input do? I tried to disable it for | |
294 | raw secondary tty support, but it does not seem to do anything | |
295 | useful. (Update: Look again. X unconditionally enables this, maybe | |
296 | that's why raw terminal support is broken again. I really do need | |
297 | to understand input.) | |
7b00d185 | 298 | |
2246281f KL |
299 | ** Maybe standard-display-table should be display-local. |
300 | ||
6548cf00 KL |
301 | DIARY OF CHANGES |
302 | ---------------- | |
303 | ||
304 | (ex-TODO items with explanations.) | |
28d440ab | 305 | |
114a8b8c | 306 | -- Introduce a new struct for terminal devices. |
28d440ab | 307 | |
daf01701 | 308 | (Done, see struct tty_output. The list of members is not yet |
28d440ab KL |
309 | complete.) |
310 | ||
28d440ab KL |
311 | -- Change the bootstrap procedure to initialize tty_list. |
312 | ||
313 | (Done, but needs review.) | |
314 | ||
28d440ab KL |
315 | -- Change make-terminal-frame to support specifying another tty. |
316 | ||
317 | (Done, new frame parameters: `tty' and `tty-type'.) | |
318 | ||
9628b887 KL |
319 | -- Implement support for reading from multiple terminals. |
320 | ||
321 | (Done, read_avail_input tries to read from each terminal, until one | |
28d7d09f | 322 | succeeds. MULTI_KBOARD is not used. Secondary terminals don't send |
6548cf00 | 323 | SIGIO!) |
9628b887 | 324 | |
819b8f00 KL |
325 | (Update: They do, now.) |
326 | ||
daf01701 KL |
327 | (Update2: After enabling X, they don't.) |
328 | ||
9628b887 | 329 | -- other-frame should cycle through the frames on the `current' |
114a8b8c | 330 | terminal only. |
9628b887 | 331 | |
6548cf00 | 332 | (Done, by trivially modifiying next_frame and prev_frame.) |
9628b887 KL |
333 | |
334 | -- Support different terminal sizes. | |
114a8b8c | 335 | |
9628b887 KL |
336 | (Done, no problem.) |
337 | ||
338 | -- Make sure terminal resizes are handled gracefully. (Could be | |
339 | problematic.) | |
340 | ||
6548cf00 KL |
341 | (Done. We don't get automatic SIGWINCH for additional ttys, |
342 | though.) | |
9628b887 KL |
343 | |
344 | -- Extend emacsclient to automatically open a new tty when it connects | |
345 | to Emacs. | |
114a8b8c | 346 | |
9628b887 KL |
347 | (Done. It's an ugly hack, needs more work.) |
348 | ||
52c2ee2a KL |
349 | -- Redisplay must refresh the topmost frame on *all* terminals, not |
350 | just the initial terminal. | |
114a8b8c | 351 | |
52c2ee2a | 352 | (Done, but introduced an ugly redisplay problems. Ugh.) |
9628b887 | 353 | |
6548cf00 KL |
354 | -- Fix redisplay problems. |
355 | ||
52c2ee2a KL |
356 | (Done; it turned out that the entire Wcm structure must be moved |
357 | inside tty_output. Why didn't I catch this earlier?) | |
6548cf00 KL |
358 | |
359 | -- Provide a way for emacsclient to tell Emacs that the tty has been | |
360 | resized. | |
361 | ||
362 | (Done, simply forward the SIGWINCH signal.) | |
363 | ||
364 | -- Each keypress should automatically select the frame corresponding | |
365 | to the terminal that it was coming from. This means that Emacs | |
366 | must know from which terminal the last keyboard event came from. | |
6548cf00 | 367 | |
52c2ee2a KL |
368 | (Done, it was quite simple, the input event system already |
369 | supported multiple frames.) | |
6548cf00 KL |
370 | |
371 | -- Fix SIGIO issue with secondary terminals. | |
372 | ||
373 | (Done, emacsclient signals Emacs after writing to the proxy pseudo | |
52c2ee2a KL |
374 | terminal. Note that this means that multi-tty does not work with |
375 | raw ttys!) | |
28d440ab | 376 | |
0a125897 KL |
377 | (Update: This is bullshit. There is a read_input_waiting function, |
378 | extend that somehow.) | |
379 | ||
819b8f00 KL |
380 | (Update of update: The first update was not right either, extending |
381 | read_input_waiting was not necessary. Secondary ttys do seem to | |
382 | send signals on input.) | |
383 | ||
daf01701 KL |
384 | (Update^3: Not any more.) |
385 | ||
fca177d4 KL |
386 | -- Make make-terminal-frame look up the `tty' and `tty-type' frame |
387 | parameters from the currently selected terminal before the global | |
388 | default. | |
389 | ||
390 | (Done.) | |
391 | ||
392 | -- Put all cached terminal escape sequences into struct tty_output. | |
393 | Currently, they are still stored in global variables, so we don't | |
394 | really support multiple terminal types. | |
395 | ||
52c2ee2a | 396 | (Done. It was not fun.) |
fca177d4 KL |
397 | |
398 | -- Implement sane error handling after initialization. (Currently | |
6548cf00 KL |
399 | emacs exits if you specify a bad terminal type.) The helpful error |
400 | messages must still be provided when Emacs starts. | |
401 | ||
fca177d4 KL |
402 | (Done.) |
403 | ||
404 | -- Implement terminal deletion, i.e., deleting local frames, closing | |
405 | the tty device and restoring its previous state without exiting | |
406 | Emacs. | |
9628b887 | 407 | |
fca177d4 KL |
408 | (Done, but at the moment only called when an error happens during |
409 | initialization. There is a memory corruption error around this | |
daf01701 | 410 | somewhere.) (Update: now it is fully enabled.) |
fca177d4 | 411 | |
8303ba32 KL |
412 | -- Implement automatic deletion of terminals when the last frame on |
413 | that terminal is closed. | |
414 | ||
415 | (Done.) | |
416 | ||
0a125897 KL |
417 | -- Restore tty screen after closing the terminal. |
418 | ||
419 | (Done, we do the same as Emacs 21.2 for all terminals.) | |
420 | ||
421 | -- 'TERM=dumb src/emacs' does not restore the terminal state. | |
114a8b8c | 422 | |
0a125897 | 423 | (Done.) |
fca177d4 | 424 | |
b2af72d2 KL |
425 | -- C-g should work on secondary terminals. |
426 | ||
427 | (Done, but the binding is not configurable.) | |
428 | ||
429 | -- Deal with SIGHUP in Emacs and in emacsclient. (After this, the | |
430 | server-frames may be removed from server.el.) | |
431 | ||
432 | (Done, nothing to do. It seems that Emacs does not receive SIGHUP | |
daf01701 | 433 | from secondary ttys, which is actually a good thing.) (Update: I |
7b00d185 | 434 | think it would be a bad idea to remove server-frames.) |
b2af72d2 | 435 | |
daf01701 | 436 | -- Change emacsclient/server.el to support the -t argument better, |
b2af72d2 KL |
437 | i.e. automatically close the socket when the frame is closed. |
438 | ||
439 | (Seems to be working OK.) | |
440 | ||
16c290d8 | 441 | -- Fix mysterious memory corruption error with tty deletion. To |
fca177d4 KL |
442 | trigger it, try the following shell command: |
443 | ||
444 | while true; do TERM=no-such-terminal-definition emacsclient -h; done | |
445 | ||
446 | Emacs usually dumps core after a few dozen iterations. (The bug | |
3224dac1 | 447 | seems to be related to the xfreeing or bzeroing of |
9d9f1812 KL |
448 | tty_output.Wcm. Maybe there are outside references to struct Wcm? |
449 | Why were these vars collected into a struct before multi-tty | |
450 | support?) | |
fca177d4 | 451 | |
16c290d8 KL |
452 | (Done. Whew. It turned out that the problem had nothing to do |
453 | with hypothetical external references to Wcm, or any other | |
454 | tty_output component; it was simply that delete_tty closed the | |
455 | filehandles of secondary ttys twice, resulting in fclose doubly | |
3224dac1 | 456 | freeing memory. Utterly trivial matter. I love the C's memory |
16c290d8 KL |
457 | management, it puts hair on your chest.) |
458 | ||
819b8f00 | 459 | -- Support raw secondary terminals. (Note that SIGIO works only on |
3224dac1 | 460 | the controlling terminal.) Hint: extend read_input_waiting for |
819b8f00 | 461 | multiple ttys and hopefully this will be fixed. |
fca177d4 | 462 | |
819b8f00 KL |
463 | (Done, it seems to have been working already for some time. It |
464 | seems F_SETOWN does work, after all. Not sure what made it fail | |
465 | earlier, but it seems to be fixed (there were several changes | |
466 | around request_sigio, maybe one of them did it). | |
3224dac1 | 467 | read_input_waiting is only used in sys_select, don't change |
daf01701 | 468 | it.) (Update: After adding X support, it's broken again.) |
d3c554a0 | 469 | (Update^2: No it isn't.) :-) |
c1c63edb | 470 | |
819b8f00 | 471 | -- Find out why does Emacs abort when it wants to close its |
0a125897 | 472 | controlling tty. Hint: chan_process[] array. Hey, maybe |
16c290d8 KL |
473 | noninterrupt-IO would work, too? Update: no, there is no process |
474 | for stdin/out. | |
c33d2d42 | 475 | |
819b8f00 KL |
476 | (Done. Added add/delete_keyboard_wait_descriptor to |
477 | term_init/delete_tty. The hint was right, in a way.) | |
6548cf00 | 478 | |
819b8f00 | 479 | -- Issue with SIGIO: it needs to be disabled during redisplay. See if |
3224dac1 | 480 | fcntl kernel behaviour could be emulated by emacsclient. |
0a125897 | 481 | |
819b8f00 | 482 | (Done. Simply disabled the SIGIO emulation hack in emacsclient.) |
d3c554a0 | 483 | (Update: it was added back.) (Update^2: and removed again.) |
22de1e79 | 484 | |
819b8f00 | 485 | -- server.el: There are issues with saving files in buffers of closed |
16c290d8 KL |
486 | clients. Try editing a file with emacsclient -f, and (without |
487 | saving it) do a delete-frame. The frame is closed without | |
488 | question, and a surprising confirmation prompt appears in another | |
489 | frame. | |
490 | ||
819b8f00 KL |
491 | (Done. delete-frame now asks for confirmation if it still has |
492 | pending buffers, and modified buffers don't seem to be deleted.) | |
493 | ||
494 | -- emacsclient.el, server.el: Handle eval or file open errors when | |
daf01701 | 495 | doing -t. |
16c290d8 | 496 | |
819b8f00 | 497 | (Done.) |
22de1e79 | 498 | |
819b8f00 KL |
499 | -- Make parts of struct tty_output accessible from Lisp. The device |
500 | name and the type is sufficient. | |
22de1e79 | 501 | |
819b8f00 KL |
502 | (Done, see frame-tty-name and frame-tty-type.) |
503 | ||
504 | -- Export delete_tty to the Lisp environment, for emacsclient. | |
22de1e79 | 505 | |
819b8f00 KL |
506 | (Done, see delete-tty.) |
507 | ||
daf01701 KL |
508 | -- Get rid of the accessor macros in termchar.h, or define macros for |
509 | all members. | |
510 | ||
511 | (Done.) | |
512 | ||
513 | -- Move device-specific parameters (like costs) commonly used by | |
514 | device backends to a common, device-dependent structure. | |
515 | ||
516 | (Done. See struct display_method in termhooks.h.) | |
517 | ||
518 | -- Fix X support. | |
519 | ||
520 | (Done. Well, it seems to be working.) | |
521 | ||
522 | -- Allow simultaneous X and tty frames. (Handling input could be | |
523 | tricky. Or maybe not.) | |
524 | ||
525 | (Done. Allowed, that is. It is currently extremely unstable, to | |
526 | the point of being unusable. The rif variable causes constant | |
527 | core dumps. Handling input is indeed tricky.) | |
819b8f00 | 528 | |
7b00d185 | 529 | -- Rewrite multi-tty input in terms of MULTI_KBOARD. |
28d440ab | 530 | |
7b00d185 KL |
531 | (Done. In fact, there was no need to rewrite anything, I just |
532 | added a kboard member to tty_display_info, and initialized the | |
533 | frame's kboard from there.) | |
819b8f00 | 534 | |
fa971ac3 KL |
535 | -- Fix rif issue with X-tty combo sessions. IMHO the best thing to do |
536 | is to get rid of that global variable (and use the value value in | |
537 | display_method, which is guaranteed to be correct). | |
538 | ||
539 | (Done, did exactly that. Core dumps during combo sessions became | |
540 | much rarer. In fact, I have not yet met a single one.) | |
541 | ||
17086732 KL |
542 | -- Add multi-tty support to talk.el. |
543 | ||
544 | (Done.) | |
545 | ||
428a555e KL |
546 | -- Clean up the source of emacsclient. It is a mess. |
547 | ||
548 | (Done, eliminated stupid proxy-pty kludge.) | |
549 | ||
550 | -- Fix faces on tty frames during X-tty combo sessions. There is an | |
551 | init_frame_faces call in init_sys_modes, see if there is a problem | |
552 | with it. | |
553 | ||
554 | (Done, there was a stupid mistake in | |
555 | Ftty_supports_face_attributes_p. Colors are broken, though.) | |
556 | ||
557 | -- C-x 5 2, C-x 5 o, C-x 5 0 on an emacsclient frame unexpectedly | |
558 | exits emacsclient. This is a result of trying to be clever with | |
559 | delete-frame-functions. | |
560 | ||
561 | (Fixed, added delete-tty-after-functions, and changed server.el to | |
562 | use it.) | |
563 | ||
564 | -- Something with (maybe) multi-keyboard support broke function keys | |
565 | and arrows on ttys during X+tty combo sessions. Debug this. | |
566 | ||
567 | (I can't reproduce it, maybe the terminal type was wrong.) | |
568 | ||
569 | -- Fix input from raw ttys (again). | |
570 | ||
571 | (Now it seems to work all right.) | |
572 | ||
573 | -- During an X-tty combo session, a (message "Hello") from a tty frame | |
574 | goes to the X frame. Fix this. | |
575 | ||
576 | (Done. There was a safeguard against writing to the initial | |
577 | terminal frame during bootstrap which prevented echo_area_display | |
578 | from working correctly on a tty frame during a combo session.) | |
579 | ||
114a8b8c | 580 | -- If there are no frames on its controlling terminal, Emacs should |
d3c554a0 | 581 | exit if the user presses C-c there. |
114a8b8c KL |
582 | |
583 | (Done, as far as possible. See the SIGTERM comment in | |
584 | interrupt_signal on why this seems to be impossible to solve this | |
585 | in general.) | |
586 | ||
587 | -- During an X session, Emacs seems to read from stdin. Also, Emacs | |
588 | fails to start without a controlling tty. | |
589 | ||
590 | (Fixed by replacing the troublesome termcap display with a dummy | |
591 | bootstrap display during bootstrap. | |
592 | ||
593 | -- Do tty output through struct display, like graphical display | |
594 | backends. | |
595 | ||
596 | (Done.) | |
597 | ||
598 | -- Define an output_initial value for output_method for the initial | |
599 | frame that is dumped with Emacs. Checking for this frame (e.g. in | |
600 | cmd_error_internal) is ugly. | |
601 | ||
602 | (Done, broking interactive temacs.) | |
603 | ||
604 | -- The command `emacsclient -t -e '(delete-frame)'' fails to exit. | |
605 | ||
606 | (Fixed.) | |
607 | ||
4ca927b4 KL |
608 | -- frame-creation-function should always create a frame that is on the |
609 | same display as the selected frame. Maybe frame-creation-function | |
610 | should simply be removed and make-frame changed to do the right | |
611 | thing. | |
612 | ||
613 | (Done, with a nice hack. frame-creation-function is now frame-local.) | |
614 | ||
615 | -- Fix C-g on raw ttys. | |
616 | ||
617 | (Done. I disabled the interrupt/quit keys on all secondary | |
618 | terminals, so Emacs sees C-g as normal input. This looks like an | |
619 | overkill, because emacsclient has extra code to pass SIGINT to | |
620 | Emacs, so C-g should remain the interrupt/quit key on emacsclient | |
621 | frames. See the next entry why implementing this distinction would | |
622 | be a bad idea.) | |
623 | ||
624 | -- Make sure C-g goes to the right frame with ttys. This is hard, as | |
625 | SIGINT doesn't have a tty parameter. :-( | |
626 | ||
627 | (Done, the previous change fixes this as a pleasant side effect.) | |
628 | ||
c0707982 KL |
629 | -- I have seen a case when Emacs with multiple ttys fell into a loop |
630 | eating 100% of CPU time. Strace showed this loop: | |
631 | ||
632 | getpid() = 30284 | |
633 | kill(30284, SIGIO) = 0 | |
634 | --- SIGIO (I/O possible) @ 0 (0) --- | |
635 | ioctl(6, FIONREAD, [0]) = -1 EIO (Input/output error) | |
636 | ioctl(5, FIONREAD, [0]) = -1 EIO (Input/output error) | |
637 | ioctl(0, FIONREAD, [0]) = 0 | |
638 | sigreturn() = ? (mask now []) | |
639 | gettimeofday({1072842297, 747760}, NULL) = 0 | |
640 | gettimeofday({1072842297, 747806}, NULL) = 0 | |
641 | select(9, [0 3 5 6], NULL, NULL, {0, 0}) = 2 (in [5 6], left {0, 0}) | |
642 | select(9, [0 3 5 6], NULL, NULL, {0, 0}) = 2 (in [5 6], left {0, 0}) | |
643 | gettimeofday({1072842297, 748245}, NULL) = 0 | |
644 | ||
645 | I have seen something similar with a single X frame, but have not | |
646 | been able to reproduce it for debugging. | |
647 | ||
648 | Update: This may have been caused by checking for nread != 0 | |
649 | instead of nread > 0 after calling read_socket_hook in | |
650 | read_avail_input. | |
651 | ||
652 | (Fixed. This was caused by unconditionally including stdin in | |
653 | input_wait_mask in init_process. The select call in | |
654 | wait_reading_process_input always returned immediately, indicating | |
655 | that there is pending input from stdin, which nobody read. | |
656 | ||
657 | Note that the above strace output seems to be an unrelated but | |
658 | similar bug. I think that is now fixed.) | |
4ca927b4 | 659 | |
2246281f KL |
660 | -- Exiting Emacs while there are emacsclient frames doesn't restore the |
661 | ttys to their default states. | |
662 | ||
663 | (This seems to be fixed by some previous change.) | |
664 | ||
665 | -- Allow opening an X session after -nw. | |
666 | ||
667 | (Done.) | |
668 | ||
d448e982 KL |
669 | -- Fix color handling during tty+X combo sessions. (It seems that tty |
670 | sessions automatically convert the face colors to terminal colors | |
671 | when the face is loaded. This conversion must happen instead on | |
672 | the fly in write_glyphs, which might be problematic, as color | |
673 | approximation is currently done in lisp (term/tty-colors.el).) | |
674 | (Update: hm, colors seem to work fine if I start emacs with -nw and | |
675 | then create an X frame. Maybe it's just a small buglet somewhere.) | |
676 | ||
677 | (Seems to be fixed. The problem was in startup.el, it did not | |
678 | initialize tty colors when the initial window system was | |
679 | graphical.) | |
2246281f | 680 | |
2441679b KL |
681 | -- emacs -nw --eval '(y-or-n-p "Foobar")' segfaults. (Reported by |
682 | Romain Francoise) | |
683 | ||
684 | (Fixed, there was a keyboard initialization problem.) | |
685 | ||
3bbdbec9 KL |
686 | -- Fix interactive use of temacs. There are face-related SEGVs, most |
687 | likely because of changes in realize_default_face, realize_face. | |
688 | ||
689 | (Fixed.) | |
690 | ||
bacb6689 KL |
691 | -- Don't exit Emacs when the last X connection fails during a |
692 | multi-display session. | |
693 | ||
694 | (Fixed.) | |
695 | ||
0c72d684 KL |
696 | -- Dan Nicolaescu noticed that starting emacsclient on the same |
697 | terminal device that is the controlling tty of the Emacs process | |
698 | gives unexpected results. | |
699 | ||
700 | (Fixed.) | |
701 | ||
4edd8a5c KL |
702 | -- Istvan Marko reported that Emacs hang on ttys if it was started |
703 | from a shell script. | |
704 | ||
705 | (Fixed. There was a bug in the multi-tty version of | |
706 | narrow_foreground_group. tcsetpgrp blocks if it is called from a | |
707 | process that is not in the same process group as the tty.) | |
708 | ||
2fc0cf2a KL |
709 | -- emacsclient -t from an Emacs term buffer does not work, complains |
710 | about face problems. This can even lock up Emacs (if the recursive | |
711 | frame sets single_kboard). Update: the face problems are caused by | |
712 | bugs in term.el, not in multi-tty. The lockup is caused by | |
d3c554a0 | 713 | single_kboard mode, and is not easily resolvable. The best thing to |
2fc0cf2a KL |
714 | do is to simply refuse to create a tty frame of type `eterm'. |
715 | ||
716 | (Fixed, changed emacsclient to check for TERM=eterm. The face | |
717 | complaints seem to be caused by bugs in term.el; they are not | |
718 | related to multi-tty.) | |
719 | ||
0b0d3e0b KL |
720 | -- Find out the best way to support suspending Emacs with multiple |
721 | ttys. My guess: disable it on the controlling tty, but from other | |
722 | ttys pass it on to emacsclient somehow. (It is (I hope) trivial to | |
723 | extend emacsclient to handle suspend/resume. A `kill -STOP' almost | |
724 | works right now.) | |
725 | ||
726 | (Done. I needed to play with signal handling and the server | |
727 | protocol a bit to make emacsclient behave as a normal UNIX program | |
728 | wrt foreground/background process groups.) | |
729 | ||
eb1f46c9 KL |
730 | -- There is a flicker during the startup of `emacs -nw'; it's as if |
731 | the terminal is initialized, reset and then initialialized again. | |
732 | Debug this. (Hint: narrow_foreground_group is called twice during | |
733 | startup.) | |
734 | ||
735 | (This is gone.) | |
736 | ||
026ad6ba KL |
737 | -- Robert Chassell has found serious copy-paste bugs with the |
738 | multi-tty branch. There seem to be redisplay bugs while copying | |
739 | from X to a terminal frame. Copying accented characters do not | |
740 | work for me. | |
741 | ||
742 | (Patch-124 should fix this, by changing the interprogram-*-function | |
743 | variables to be frame-local, as suggested by Mark Plaksin | |
744 | (thanks!). I think that the redisplay bugs are in fact not bugs, | |
745 | but delays caused by single_kboard --> perhaps MULTI_KBOARD should | |
746 | be removed.) | |
747 | ||
2cd1371d KL |
748 | -- frame-creation-function was removed, which might be a bad idea. |
749 | Think up a compatible solution. | |
750 | ||
751 | (It was an internal interface that may be changed when necessary.) | |
752 | ||
753 | -- Change Lisp code not to (getenv "TERM"); use the `tty-type' frame | |
754 | parameter or the frame-tty-type function instead. (M-x tags-search | |
755 | "TERM" helps with this.) Update: Actually, all getenv invocations | |
756 | should be checked for multi-tty compatibility, and an interface | |
757 | must be implemented to get the remote client's environment. | |
758 | ||
759 | (Done. Only getenv calls in lisp/term/*.el were changed; other | |
760 | calls should be mostly left as they are.) | |
761 | ||
762 | -- Add an elaborate mechanism for display-local variables. (There are | |
763 | already a few of these; search for `terminal-local' in the Elisp | |
764 | manual.) | |
765 | ||
766 | (Not needed. Display-local variables could be emulated by | |
767 | frame-local variables.) | |
026ad6ba | 768 | |
d4d89d37 KL |
769 | -- Emacs assumes that all terminal frames have the same locale |
770 | settings as Emacs itself. This may lead to bogus results in a | |
771 | multi-locale setup. (E.g., while logging in from a remote client | |
772 | with a different locale.) | |
773 | (Update after new bugreport by Friedrich Delgado Friedrichs: | |
774 | (at least) the structs terminal_coding and keyboard_coding in | |
775 | coding.c must be moved to struct display, and the Lisp interface | |
776 | [set-]keyboard-coding-system must be adapted for the change.) | |
777 | ||
778 | (Fixed. Emacs now uses the locale settings as seen by the | |
779 | emacsclient process for server tty frames.) | |
0b0d3e0b | 780 | |
b6660415 KL |
781 | |
782 | -- Make `struct display' accessible to Lisp programs. Accessor functions: | |
783 | ||
784 | (displayp OBJECT): Returns t if OBJECT is a display. | |
785 | => Implemented as display-live-p. | |
786 | ||
787 | (display-list): Returns list of currently active displays. | |
788 | => Implemented. | |
789 | ||
790 | (selected-display): Returns the display object of the selected frame. | |
791 | => Not strictly necessary, but implemented anyway. | |
792 | ||
793 | (frame-display FRAME): Returns the display object of FRAME. | |
794 | => Implemented. | |
795 | ||
796 | (display-frames DISPLAY): Returns a list of frames on DISPLAY. | |
797 | => Already implemented, see frames-on-display-list. | |
798 | ||
799 | (display-type DISPLAY): Returns the type of DISPLAY, as a | |
800 | symbol. (See `framep'.) | |
801 | => Implemented as display-live-p. | |
802 | ||
803 | (display-device DISPLAY): Returns the name of the device that | |
804 | DISPLAY uses, as a string. (E.g: "/dev/pts/16", or | |
805 | ":0.0") | |
806 | => Implemented as display-name. | |
807 | ||
808 | etc. | |
809 | ||
810 | See next issue why this is necessary. | |
811 | ||
812 | (Update: The consensus on emacs-devel seems to be to do this via | |
813 | integer identifiers. That's fine by me.) | |
814 | ||
815 | (Done.) | |
816 | ||
817 | -- The following needs to be supported: | |
818 | ||
819 | $ emacsclient -t | |
820 | C-z | |
821 | $ emacsclient -t | |
822 | (This fails now.) | |
823 | ||
824 | The cleanest way to solve this is to allow multiple displays on the | |
825 | same terminal device; each new emacsclient process should create | |
826 | its own display. As displays are currently identified by their | |
827 | device names, this is not possible until struct display becomes | |
828 | accessible as a Lisp-level object. | |
829 | ||
830 | (Done.) | |
831 | ||
28d440ab | 832 | ;;; arch-tag: 8da1619e-2e79-41a8-9ac9-a0485daad17d |